According to a study, the approximate level of intelligence of a person can be calculated using the following formula: i = 2 + ( y + 0.5 x ) Write a program, which 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.
According to a study, the approximate level of intelligence of a person can be calculated using the following formula: i = 2 + ( y + 0.5 x ) Write a program, which 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. Let C Solution: #include<stdio.h> main() { int y; float i,x; for (y=1; y<=6; y++) { for (x=5.5; x<=12.5;x=x+0.5) { i=2 + (y+ (0.5*x)) ; printf("\n i=%.2f, y=%d, x=%.2f", i, y, x); } } } output: i=5.75, y=1, x=5.50 i=6.00, y=1, x=6.00 i=6.25, y=1, x=6.50 i=6.50, y=1, x=7.00 i=6.75, y=1, x=7.50 i=7.00, y=1, x=8.00 i=7.25, y=1, x=8.50 i=7.50, y=1, x=9.00 i=7.75, y=1, x=9.50 i=8.00, y=1, x=10.00...
Comments
Post a Comment