Question: #include int main() int x = 6, y = 10; printf( Enter two numbers (separated by spaces) : int values-read = scanf(%d %d, &x,

 #include int main() int x = 6, y = 10; printf(

#include int main() int x = 6, y = 10; printf( "Enter two numbers (separated by spaces) : " int values-read = scanf("%d %d", &x, &y); if (values-read != 2){ printf("scanf was unable to read both values n"); printf( "The value of x is %d and the value of y is %d ", x,y); return 0; Exercise : Using your program from the previous section as a basis, write a program which reads floating point values (including the value "O", if it appears) from the user until an invalid input (such as "asdf" or "q") is encountered, then prints the sum of all values entered up until the invalid input and exits. For example, if the user enters the sequence 6 100 1.7 1.87 0 qit, the output should be "Sum: 19.57". The program should be able to read as many values as the user can provide

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!