We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

CS201 Pre-Assignment Solution & Discussion Fall 2015

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

__________________________________________

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 1078

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

Please Discuss here about this assignment.Thanks

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.

#include <iostream>
using namespace std;
int main()
{
int sum;
int lowerlimit;
int upperlimit;
int even;
int odd;
sum=0;
cout"please enter the lowerlimit";
cin>>lowerlimit;
cout"please enter the upperlimit";
cin>>upperlimit;
while(lowerlimit<=upperlimit)
{
sum=sum+lowerlimit;
lowerlimit=lowerlimit+1;
coutsum"\t";

if((sum%2)==0)
{
even=even+1;
}

else
{
odd=odd+1;
}
}
cout"even numbers "evenendl;
cout"odd numbers"oddendl;
}

#include<iostream>
using namespace std;
main()
{
int lowerLimit,upperLimit,i,sum=0,even=0,odd=0;
cout"Please enter lowerLimit:";
cin>>lowerLimit;
cout"Please enter upperLimit:";
cin>>upperLimit;
for(int i=lowerLimit;i<upperLimit;i++)
{
sum=sum+i;
coutsum"\t";
}
if((sum%2)==0)
{
even++;
}
else{
odd++;
}
lowerLimit++;
}

This is ur omplete code ayyzzi bhai

#include<iostream>
using namespace std;
main()
{
int lowerLimit,upperLimit;
int sum=0,even=0,odd=0;
cout"Please enter lowerLimit:";
cin>>lowerLimit;
cout"Please enter upperLimit:";
cin>>upperLimit;

for(int i=lowerLimit;i<=upperLimit;i++)
{
sum=sum+i;

coutsum"\t";

if((sum%2)==0)
{
even=even+1;
}
else
{
odd=odd+1;
}
}

cout "even numbers "even endl;
cout "odd numbers"odd endl;

}

#include<iostream>
using namespace std;
int main()
{
int lowerLimit,upperLimit,i,sum=0,even=0,odd=0;
cout"Please enter lowerLimit:";
cin>>lowerLimit;
cout"Please enter upperLimit:";
cin>>upperLimit;
for(int i=lowerLimit;i<=upperLimit;i++)
{
sum=sum+i;
lowerLimit++;
coutsum"\t";

if((sum%2)==0)
{
even++;
}
else{
odd++;
}
}
cout"even numbers "evenendl;
cout"odd numbers"oddendl;

}

No assignment exists for this course.

hey,

ive tried to write this code,ive taken help from your comments as well

but the result which im getting is without any space

like for the same limits 3 and 8 my result is coming as

3712182533even numbers are2odd numbers are4

heres the code,can u please check it?

#include <iostream>
using namespace std;
int main()
{
int sum;
int odd;
int even;
int upperlimit;
int lowerlimit;
sum=0,odd=0,even=0;
cout"Please enter the lower limit : ";
cin>> lowerlimit;
cout"please enter the upper limit : ";
cin>> upperlimit;

while(lowerlimit<=upperlimit)
{
sum=sum+lowerlimit;
lowerlimit=lowerlimit+1;

coutsum;

if((sum%2)==0)
{
even=even+1;
}
else
{
odd=odd+1;
}
}
cout"even numbers are"even;
cout"odd numbers are"odd;

}

Hi Friends In this video help of new students of CS201 and discus first program of C++

Plz wtch This video for Learn and write first program.

First Program In C++ and 

watch other video of C++

Play List of C++ All Tutorials

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.