CS201 Assignment No 1 Solution Spring 2017 | Virtual Study Solutions

Adsetra Ads

 

CS201 Assignment No 1 Spring 2017

Here 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. 

we have also added : CS201 Assignment No 1 Solution Fall 2017

CS201 Assignment No 1 Spring 2017 Solution and discussion
CS201 Assignment No 1 Spring 2017 Solution and discussion
Recommended : CS 201 all past solved midterm papers 2015

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).
Recommended : CS201 VIVA Preparation Helping Material

Software allowed to develop CS201 Assignment 

  • Dev C++
Recommended : DevC++ Installation and Usage Complete Guidelines

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
Recommended : CS201 Solved Short Notes 2017

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.

Recommended : CS201 Most Important Questions for VIVA

CS201 Assignment Assignment No 1

Question:
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 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.

Recommended : Write ALLAH Using C++ Program

CS201 Assignment No 1 Solution Spring 2017

#include <iostream>
using namespace std;

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 < 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;
                              break;
                          }
                      }
                      if (isPrime)
                      {
                       
                          cout<<i<<" ";
                          numberofPrimeNumbers++;
                          sum+=i;
                      }
                     
            }
         
            cout << "\n\nTotal number of prime numbers between the range are : " << numberofPrimeNumbers<<endl;
            cout << "Sum of the prime numbers between the range is : " << sum<<endl;
         
        }
        else if(lowerLimit < 2)
        {
            cout<< "Lower Limit can not be less then 2!";
        }
        else
        {
            cout<< "Lower Limit can not be greater then or equal to the Upper Limit!";
        }
         
      
     
return 0;

}

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

Post a Comment

  1. in last condition it shows all the the parameters including prime number sum, etc , but it has to display only the error quoting no lower limit less than 1... kindly help us in this regard

    ReplyDelete

 

Top