Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Assignment No.  1
Semester: Spring 2017

CS201 – Introduction to Programming


Total Marks: 20


Due Date: 4 May 2017




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 Assignment

-          Dev C++



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



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.





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.





Sample output for correct input:



Sample output for the wrong input:



Sample output for the wrong input:









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.


Views: 2437


Replies to This Discussion

#include <iostream>
using namespace std; 

int main() 

int lowerLimit,sum,upperlimit,numberofPrimeNumbers;

sum = 0;
numberofPrimeNumbers =0;

cout "Please enter a LowerLimit.....:"; 
cin >> lowerLimit; 
cout "Please enter an UpperLimit.....:";
cin >> upperlimit;

if(lowerLimit > 2)

if(lowerLimit < upperlimit)

cout "\n\nPrime numbers between the range are : "endl; 

for(int i = lowerLimit; i <= upperlimit; i++) 
bool isPrime=true;

for(int j = 2; j <= i / 2; ++j) 
if(i % j == 0) 
isPrime = false;
if (isPrime) 

couti" ";
numberofPrimeNumbers++; ////// add count 
sum+=i; ////////sum prime number


cout "\n\nTotal number of prime numbers between the range are : " numberofPrimeNumbersendl;
cout "Sum of the prime numbers between the range is : " sumendl;

cout "Lower Limit can not be greater then or equal to the Upper Limit!"; 

cout "Lower Limit can not be less then 2!";


return 0;


i hv tried this prog but it is not working

assignment solution



on providing upper limit and pressing enter the box disappears, Why it is so?

same prob here

assalam o alaikum! is this assignment is right

Is it authentic bro?

Dear Students Don’t wait for solution post your problems here and discuss ... after discussion a perfect solution will come in a result. So, Start it now, replies here give your comments according to your knowledge and understandings....

Assignment cs201 



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

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