Q19 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 of 0.5.

the approximate level of intelligence of a person can be calculated using the following formula: i=2+(y+0.5x)

Program:112

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 c 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 1 to 6
    float i, x;

    //print column names
    printf("i\t\ty\tx\n");

    //for loop for y range (1 to 6)
    for(y=1;y<=6;y++)
    {
        //for loop for every value y range (5.5 to 12.5 step .5)
        for(x=5.5;x<=12.5;x=x+0.5)
        {
            //formula for intelligence
            i = 2+(y+0.5*x);

            //print the values
            printf("%.2f\t\t%d\t%.2f\n",i,y,x);
        }
    }
}

Output:

i       y x
5.75 1 5.50
6.00 1 6.00
6.25 1 6.50
6.50 1 7.00
6.75 1 7.50
7.00 1 8.00
7.25 1 8.50
7.50 1 9.00
7.75 1 9.50
8.00 1 10.00
8.25 1 10.50
8.50 1 11.00
8.75 1 11.50
9.00 1 12.00
9.25 1 12.50
6.75 2 5.50
7.00 2 6.00
7.25 2 6.50
7.50 2 7.00
7.75 2 7.50
8.00 2 8.00
8.25 2 8.50
8.50 2 9.00
8.75 2 9.50
9.00 2 10.00
9.25 2 10.50
9.50 2 11.00
9.75 2 11.50
10.00 2 12.00
10.25 2 12.50
7.75 3 5.50
8.00 3 6.00
8.25 3 6.50
8.50 3 7.00
8.75 3 7.50
9.00 3 8.00
9.25 3 8.50
9.50 3 9.00
9.75 3 9.50
10.00 3 10.00
10.25 3 10.50
10.50 3 11.00
10.75 3 11.50
11.00 3 12.00
11.25 3 12.50
8.75 4 5.50
9.00 4 6.00
9.25 4 6.50
9.50 4 7.00
9.75 4 7.50
10.00 4 8.00
10.25 4 8.50
10.50 4 9.00
10.75 4 9.50
11.00 4 10.00
11.25 4 10.50
11.50 4 11.00
11.75 4 11.50
12.00 4 12.00
12.25 4 12.50
9.75 5 5.50
10.00 5 6.00
10.25 5 6.50
10.50 5 7.00
10.75 5 7.50
11.00 5 8.00
11.25 5 8.50
11.50 5 9.00
11.75 5 9.50
12.00 5 10.00
12.25 5 10.50
12.50 5 11.00
12.75 5 11.50
13.00 5 12.00
13.25 5 12.50
10.75 6 5.50
11.00 6 6.00
11.25 6 6.50
11.50 6 7.00
11.75 6 7.50
12.00 6 8.00
12.25 6 8.50
12.50 6 9.00
12.75 6 9.50
13.00 6 10.00
13.25 6 10.50
13.50 6 11.00
13.75 6 11.50
14.00 6 12.00
14.25 6 12.50
Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.