cs201 assignment 1 solution 2021

cs201 assignment 1 solution 2021
Spread the love

Here we have provided cs201 assignment 1 solution 2021. We have made this solution of cs201 assignment 1 spring 2021 just to support students. We suggest you that Always edit the solution file, before uploading it on your LMS. In this case, the instructor will give you 0 marks. So first of all watch the given below video and understand the solution and also learn that how you can edit the cs201 assignment 1 solution 2021 file.


#include <iostream>

using namespace std;

int main()
{
        
    int x,y,Z;
    x=2;
    y=1;
    
    Z = (x*x)+(2*y*x)-(x/y);
    cout<<"After evaluation of given expression the value of z = "<<Z<<endl;
    
    string ID = "BC";
    int id2 = 200205672; // remove and enter any student id here (not real)
    string name = "Muhammad Sarim"; // enter your name into my name
    int lastdigit;
    int Gotnumber;
    
    
    lastdigit = id2 % 10;
    cout<<"Last digit of VU ID is "<<lastdigit<<endl;
    Gotnumber = Z + lastdigit;
    
    // using if else condition
    string test;
    int n = 1;
    if ((lastdigit % 2) == 0)
    {
        test = "even";
        cout<<"I got an "<<test<<" number "<<Gotnumber<<endl;
        while (n <= Gotnumber)
        {
            cout<<"Iteration: "<<n<<endl;
            cout<<"My name is "<<name<<endl;
            n++; 
        }
    }
    else
    {
        test = " odd";
        cout<<"I got an "<<test<<" number "<<Gotnumber<<endl;
        while(n <= Gotnumber)
        {
            cout<<"Iteration: "<<n<<endl;
            cout<<"My VU ID is "<<id2<<endl;
            n++;
        }
    }

    return 0;
}

Author: Prof. Azhar Sagar

I am a professor of computer science In the Punjab group of colleges. A highly dedicated, professional, and accomplished computer science with extensive knowledge of teaching computer science, is here to help students become masters in the field. I have developed blog groups and websites for students to help in assignments, tutorials, and final year projects, etc.

Leave a Reply