Exercise[6B(b),LET US C SOLUTION

 Exercise[6B(b)]

According to a study,the approximate level of intelligence of 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 of 0.5.   */
#include<stdio.h>
int main()
{
	int y;
	// y is integer varies from 1 to 6.
	float i,x;
	printf("i\t y\t x\n");
	for(y=1;y<=6;y++)
	{
		for(x=5.5;x<=12.5;x=x+0.5)
		{
			// formula for intelligence
			i=2+(y+0.5*x);
			printf("%2f\t %d\t.2f\n",x,y,x);
		}
	}
	return 0;
}

Post a Comment

0 Comments