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