62.3k views
3 votes
Assume the following variables are defined: int age; double pay; char section; write a single c instatement that will read input into each of these variables. in c ++

User CT Zhu
by
4.5k points

1 Answer

4 votes

Answer:

scanf("%d %lf %c", &age, &pay, &section);

Step-by-step explanation:

To read the value in c program, the instruction scanf is used.

To read the integer value, use the %d format specifier in the scanf and corresponding variable name age with ampersand operator.

To read the double value, use the %lf format specifier in the scanf and corresponding variable name pay with ampersand operator.

To read the character value, use the %c format specifier in the scanf and corresponding variable name section with ampersand operator.

User Cristi Jora
by
3.9k points