Assignment No 1
Assignment No 1
Assignment No:01
Deprtment: BSEE(Section-B)
Registration No: BSEE-12637-2020
Submitted by:
Submitted to:
Task No:01
Coding:
#include<iostream>
using namespace std;
int main()
{
system("color 70");
float a,b ,z;
int x, y,remainder;
char op;
case '-':
cout << "enter the value of a and b \n";
cin >> a >> b;
z = a - b;
cout << "difference of two numbers = " << z;
break;
case'*':
cout << "enter the value of a and b \n";
cin >> a >> b;
z = a * b;
cout << "multiplication of two numbers = " << z;
break;
case'/':
cout << "enter the value of a and b \n";
cin >> a >> b;
if (b != 0)
{
z = a / b;
cout << "divison of two numbers = " << z;
}
else
{
cout << "error";
}
break;
case'%':
}
}
Output:
Task No:02
Coding:
#include<iostream>
using namespace std;
int main()
{
system("color 70");
int x, y, z, sum,average;
cout << "enter the value of x \n";
cin >> x;
cout << "enter the value of y \n";
cin >> y;
cout << "enter the value of z \n";
cin >> z;
sum = x + y + z;
cout << "sum of x,y and z is = " << sum<<endl;
average = (sum / 3);
cout << "average of x,y and z is = " << average;
getchar();
return 0;
Output:
Task No:03
Coding:
#include<iostream>
using namespace std;
int main()
{
system("color 70");
int x, y, BMI;
int unit;
cout << "enter 1 for BMI in pound per square inch" << endl;
cout << "enetr 2 for BMI in kg per square meter " << endl;
cin >> unit;
switch (unit)
{
case 1:
cout << "enter weight in pounds : ";
cin >> x;
cout << "enter height in inches : ";
cin >> y;
BMI = (x * 703) / (y * y);
cout << "BMI is equal to :" << BMI << " pound per square
inch";
break;
case 2:
cout << "enter weight in kg : ";
cin >> x;
cout << "enter height in meter : ";
cin >> y;
BMI = (x * 703) / (y * y);
cout << "BMI is equal to :" << BMI <<" kg per square meter";
break;
Output:
Task No:04
Coding:
#include<iostream>
using namespace std;
int main()
{
system("color 70");
float Vf, Vi, a, S, t;
int unit;
cout << "enter unit 1 for first equation\n enter 2 for second
equation \n enter 3 for third equation \n";
cin >> unit;
switch (unit)
{
case 1:
cout << "find Vf\n";
cout << "enter Vi in meter per second\n ";
cin >> Vi;
cout << "enter a in meter per second square\n ";
cin >> a;
cout << "enter time t in second\n ";
cin >> t;
Vf = Vi + (a * t);
cout << "Vf is" << Vf << "m/s";
break;
case 2:\
cout << "find S\n";
cout << "enter Vi in meter per second\n ";
cin >> Vi;
cout << "enter a in meter per second square\n ";
cin >> a;
cout << "enter time t in second\n ";
cin >> t;
S = (Vi * t) + (1 / 2 * a * t * t);
cout << "S is" << S << "m";
break;
case 3:
cout << "find a\n";
cout << "enter Vi in meter per second\n ";
cin >> Vi;
cout << "enter S in meter\n ";
cin >> S;
cout << "enter Vf\n ";
cin >> Vf;
getchar();
return 0;
Output: