luc035.c (735B)
1 /* According to a study, the approximate level of intelligence of a 2 person can be calculated using the following formula. 3 i = 2 + (y + 0.5x) 4 write a program that will produce a table of values of i, y and x, 5 where y varies from 1 to 6, and, for each value of y, x varies from 6 5.5 to 12.5 in steps of 0.5 */ 7 /* Let Us C, Chap- 6, Page - 105, Qn No.: B(b) */ 8 9 #include <stdio.h> 10 int main() 11 { 12 double y, x; 13 printf("\n--- Approximate Intelligence ---\n"); 14 for (y = 1; y <= 6; y++) 15 { 16 printf("\tY = %d\n", y); 17 for (x = 5.5; x <= 12.5; x += 0.5) 18 { 19 printf("Y: %g\t X: %.2g\t I: %g\n", y, x, 2 + (y + 0.5 * x)); 20 } 21 printf("-----------------------\n"); 22 } 23 return 0; 24 }