Gud Luck for Final Term Examination Spring 2017

Gud Luck for Final Term Examination Spring 2017

CS201 Pre-Assignment Solution and Discussion 

Pre – Assignment practice program (Graded)
Problem statement:
                You are required to write a program in which the program will ask the user to enterLower limit and Upper limit for a loop. It means that loop will start from the lower limit and will execute till the upper limit. After taking the input, the program should show the sum of all the numbers from lower limit to upper limit in each iteration of the loop. For example if the user enters 3 as lower limit and 8 as upper limit. The output should be as:
3  7  12  18  25  33
What you are doing here is you are adding the lower limit into the number next to it and showing it in the same iteration.
Also the program will count the even and odd numbers in the output. In this example, the count of the even numbers will be 2 and the odd numbers will be 4. So the final output would be

Sample Output:
Enter the lower limit for the loop: 3
Enter the upper limit for the loop: 8
3  7  12  18  25  33
Even numbers: 2
Odd numbers: 4

Our main purpose here discussion not just Solution
We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.


using namespace std;
int lowerLimit,upperLimit;
int sum=0,even=0,odd=0;
cout"Please enter lowerLimit:";
cout"Please enter upperLimit:";
for(int i=lowerLimit;i<=upperLimit;i++)
cout "even numbers "even endl;
cout "odd numbers"odd endl;

You Can Download Solved Mid Term Papers, Short Notes, Lecture Wise Questions Answers Files, Solved MCQs, Solved Quizzes , Solved Mid Term Subjective Papers , Solved Mid Term Objective Papers From This Discussion For Preparation Mid Term Papers of Fall 2015
For important helping material related to the subject ( Solved MCQsAssignmentsShort NotesSolved Past Papers, E-Books, Recommended Books, FAQs, Help & Tutorials , Short Questions Answers & more). You must view all the featured discussion in this subject group.

Post a Comment