CS201 Assignment No 1 Solution Fall 2017 | Virtual Study Solutions

Adsetra Ads

 

CS201 Assignment No 1 Fall 2017

Dear Students, Here You can read and download CS201- Introduction to Programming Assignment No 1 Solution and discussion of Fall 2017. CS201 Assignment Due Date: 6 November, 2017. Assignment Total Marks: 20. Previously we shared CS201 Solved Short Notes 2017.

CS201 Assignment No 1 Solution Spring 2018 - Download

CS201 Assignment No 1 Solution Fall 2017
CS201 Assignment No 1 Solution Fall 2017

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

CS201 Assignment Objectives:

To enable students to understand and practice the concepts of:
  • Variables and operators
  • Expressions in C++
  • Decision structures
  • Repetition structures

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.

Software allowed to develop Assignment:


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

CS201 Assignment No 1

Write a program that will Ask the user to enter lower limit and upper limit in the form of integer numbers.
The program will then add / sum all those numbers between upper limit and lower limit (including the lower and upper limits) which are NOT multiple of 4.
This process should continue for all the remaining integer numbers up until the upper limit is reached.
The program will then show the aggregate sum of all numbers for the given range.

Make sure that lower limit entered by the user should be greater than zero. Also the upper limit value entered by the user should be greater than the lower limit value.

Example:
Lower limit is 1 and Upper limit is 8 then the program will subtract 4 and 8 as these are the multiples of 4. While add remaining integers in the range (1+2+3-4+5+6+7-8 = 12). So, 12 is the calculated number.

CS201 Assignment No 1 Solution


#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int upperlmt, lowerlmt, sum=0,a;
cout<<"please enter lower limit greater then zero=";
cin>>lowerlmt;
      if (lowerlmt>0)
{
cout<<"please enter upper limit greater than lower limit=";
cin>>upperlmt;
                  if (upperlmt>lowerlmt)
{
for(a=lowerlmt; a<=upperlmt; a++)
                               {
                               if(a%4==0) 
                               {
                               sum=sum-a;
                               } 
                               else
                               {
                               sum=sum+a;
                               }

                                               }
cout<<"calculated number is="<<sum;
                                }
                                else
                                {
cout<<"upper limit must be greater than lower limit";
                                                           }
                  }
else
{
cout<<"lower limit should be greater then zero";
    }
    system("pause");

return 0;
}

Assignment Solution Source Code Output

You can see the Sample output of Cs201 Assignment Solution Source code in image given below. it works fine. Please test it in your compiler before submitting the Assignment.
CS201 Assignment Solution Source Code Sample Output
CS201 Assignment Solution Source Code Sample Output

CS201 Assignment Solution Download Link

You can download Assignment solution in .cpp format from the download button given below:

Download


Recommended : C++ Programming Tutorial for beginners with simple and easy learning


If Assignment Solution was helpful Please Share it with your friends. You can also like our Face
book Page or Subscribe Us below for Updates. Thank You.

Post a Comment

 

Top