You are on page 1of 3

Please do steps before submit

1. Please Change VU ID AND Name


2. Copy all and paste in DEV C++
3. Click File and Save as
4. Select Folder and Upload CPP File

#include <iostream>
using namespace std;

main()
{
cout<<"\tCS201 Assignment 1 Solution" <<endl;
cout<<"\t\t Spring 2021"<<endl;
cout<<"\tby Abdul Hadi E Services \n" <<endl <<endl;

//Solving Expression
int x, y, Z;
x=2, y = 1;
Z= (x*x)+(2*x*y)-(x/y);
cout<<"After evalution of given expression the value of z = "<<Z <<endl;
// Student ID and Anylizing
string ID = "BC" ;
int id2 = 2000201127;
string Name = "Moazzam Ali";
int lastdigit;
int Gotnumber;
///Evaluation of ID
lastdigit = id2 % 10;
cout<<"Last digit of my vu ID is "<<lastdigit <<endl;
Gotnumber = Z + lastdigit;

// IF else Loop
//Adding last digit of ID and Z and print result Odd or Even

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 " <<ID <<id2 <<endl;
n++;
}
}
}

You might also like