Page Rank Checker

Saturday 5 July 2014

Calculate Approximate Intelligence Program In C


This article is from solution of Let Us C by Yashwant Kanetkar. I also posted many another articles regarding solutions of Let Us C. If you have any problem regarding solution then give comment, I will surely reply your question.

Q. According to a study, the approximate level of intelligence of a person can be calculated using the following formula:
     i = 2 + (y + 0.5x)
     Write a program that will produce a table of values of i, y and x, where y varies from 1 to 6, and, for each value of y, x varies from 5.5 to 12.5 in steps 0.5.

Ans.

#include<stdio.h>
#include<conio.h>
void main()
{
    clrscr();
    float i, y, x;
    printf("Values Of\n");
    printf("i \ty \tx");
    for(y=1;y<=6;y++)
    {
        for(x=5.5;x<=12.5;x=x+0.5)
        {
            i=2+(y + (0.5*x));
            printf("%10f \t%10f \t%10f\n",i,y,x);
        }
    }
    getch();
}