CS201 Assignment No 1 Spring 2017Here You can read and download CS201- Introduction to Programming Assignment No 1 Solution and discussion of Spring 2017. CS201 Assignment Due Date: 4 May 2017. Assignment Total Marks: 20.
|CS201 Assignment No 1 Spring 2017 Solution and discussion|
CS201 Assignment Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
- Assignment is submitted after due date.
- Submitted assignment does not open or file is corrupt.
- Assignment is copied (From internet/students).
Software allowed to develop CS201 Assignment
- Dev C++
CS201 Assignment Objectives:
To enable students to write, compile and execute a program in DevC++. Moreover to familiarize students with the concepts of:
- Variables and operators
- Expressions in C++
- Decision structures
- Repetition structures
- Break and Continue statements
CS201 Assignment Submission Instructions
You have to submit only.cpp file on the Assignments interface of CS201 at VULMS.
Assignment submitted in any other format will not be accepted and will be graded zero marks.
CS201 Assignment Assignment No 1
Write a program that will ask the user to enter lower limit and upper limit in form of integers. The program will calculate and show the prime numbers within the range from lower limit to upper limit. All the prime numbers within the specified range should be displayed on the output. The program should also aggregate all the prime numbers within the range and show their sum as well. Also show the total number of prime numbers within the specified range.
Make sure that the user should not be able to enter a negative value or a value less than 2. Also the value entered as lower limit should not be greater than the upper limit.
|CS201 Assignment Question No 1|
CS201 Assignment Deadline:
The deadline to submit your assignment solution is 4th May, 2017. Your assignment must be submitted within the due date through VULMS. No assignment will be accepted through email after the due date.
CS201 Assignment No 1 Solution Spring 2017
sum = 0;
cout << "Please enter a LowerLimit.....:";
cin >> lowerLimit;
cout << "Please enter an UpperLimit.....:";
cin >> upperlimit;
if(lowerLimit < upperlimit)
cout << "\n\nPrime numbers between the range are : "<<endl;
i = lowerLimit; i <= upperlimit; i++)
j = 2; j <= i / 2; ++j)
if(i % j == 0)
isPrime = false;
cout << "\n\nTotal number of prime numbers between the range are : "
cout << "Sum of the prime numbers between the range is : "
if(lowerLimit < 2)
cout<< "Lower Limit can not be less then 2!";
cout<< "Lower Limit can not be greater then or equal to the Upper Limit!";
Download Cs201 Assignment No 1 solution in CPP format
Recommended for Cs201 Students:
If You liked this Post Please share it with your friends. Thank You