Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Would you solve this please? Concepts to Practice For loops .Do/while loops . Switch Extend Prelab 3 Submission Information Submit this or executable file is

Would you solve this please?
image text in transcribed
image text in transcribed
Concepts to Practice For loops .Do/while loops . Switch Extend Prelab 3 Submission Information Submit this or executable file is assignment by following the instructions given by your TA. SUBMIT ONLY the .c file (no a.out required). All of the lab assignments must be submitted before the end of the lab using the lab code given by the TA Use the following submit command: submit sclass> cassignment> For example submit CS1050 Lab 3 m-lab3.c Filename must be: sectionletter-lab3.c (include your respective lab section),e.g., c-lab3.c Description For the lab assignment, you may not use the if statement nor may you use the if/else statement. You also may not use a while statement. You are to write a program that calculates summations from O up to and including a maximum number given by the user. If a user enters a negative number, issue an error message and do not proc ess the negative number. Note that since you cannot use an if or if/else u may want to think about using a Boolean in a switch statement, or perhaps combining a switch with a ternary operator to determine how to handle a negative number. ONUS: At the end of the program, print the largest summation you calculated. 7 Sample Output 1 (bold and JimRe nRAreaS1 : $ . /a. out Enter the high 1imit of the summaton youwish to calculate:-s underline shows user input) ast:s compile m-lab3.c Error: You must enter a non-negative number Enter e to quit or 1 to continue:1 Enter the high limit of the summation you wish to calculato: Error: You must enter a non-negative number Enter e to quit or 1 to continue: 1 Enter the high limit of the summation you wish to calculate:s Calculating summations up to 5 Summation(e. .e) Summation(e.. 1)1 Summation(e..2) 3 Summation (e. .3) 6 Summation(8. .4) 10 Summation(e..5) 15 Enter to quit or 1 to continue: 1 Enter the high limit of the summation you wish to calculate: 10 Calculating summations up to 10 Summation(e..e) Summation (e.. 1) 1 Summation (0..2)3 Summation(0..3) 6 Summatio(0..4)10 Summation(0.. 5) 15 Summation(..6) 21 Summation(0.. 7) 28 Summation(0..8) 36 Summation(..9) -45 Summation(0..10) 55 Enter to quit or 1 to continue : e The largest summation you calculated was 55

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

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions