Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions