Question: HELP WITH C PROGRAMMING Write a do-while loop that asked user for a int, char, float and double, and returns a print of the values

HELP WITH C PROGRAMMING

Write a do-while loop that asked user for a int, char, float and double, and returns a print of the values of the 4 inputs. The do-while loop should stop if the EOF (end of file) character is read from standard input or if an invalid number of input items is received, at which point your program should terminate. This is what I got so far. Please stay close to what I wrote.

#include // for printf()

int main(){ int a; char b; double c; float d; do { printf("Enter a int: ); int n = scanf(%d,&a); printf("Enter a char: ); int n = scanf(%c,&b); printf("Enter a float: ); int n = scanf(%f,&c); // is this a float input?? printf("Enter a double: ); int n = scanf(%lf,&d); // Is this a double input?

printf("The number of items read are %d. They are as follows ",n); printf(%d%c%.1f%.4lf ,a,b,c,d);

} while(n != EOF || n<=4); // do while it is not EOF or more than 4 inputs??? }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!