Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Ministry of Higher Education

Higher Technological Institute

10th of Ramadan City

Biomedical Engineering Department

PROGRAMMING
with C++
[TASK 1]
Student Name: Ahmed Fouad Mohamed
ID: 20190118

Course Code: EDE 125


Group: (81)

Supervisor
Dr. Nour S. Bakr
Eng . Manar Fathy

1
Ex 1:
#include <iostream>
using namespace std;

int main()
{
int ID;
cout << "Name:Ahmed Fouad Mohamed Waghe " << endl;
cout << "________________________________" << endl;
cout << "Enter ID : "; cin >> ID;
cout << "________________________________" << endl;
cout << " program reads an integer, determines and prints whether itis
odd or even " << endl;
cout <<
"__________________________________________________________________________"
<< endl;
int n;
cout << "Enter an integer : ";
cin >> n;
if (n % 2 == 0)
cout << n << " : is even" << endl;
if (n % 2 != 0)
cout << n << " : is odd" << endl;
return 0;
}

2
Ex 2:
# include <iostream>
using namespace std;
int main()
{
int ID;
cout << "Name:Ahmed Fouad Mohamed Waghe " << endl;
cout << "________________________________" << endl;
cout << "Enter ID : "; cin >> ID;
cout << "________________________________" << endl;
cout << " program inputs three integers and prints the sum, aversge,
product, smallest and largest of these numbers " << endl;
cout <<
"____________________________________________________________________________
_______________________________" << endl;
int x, y, z, smallest, largest;
cout<< "Input three different integers : ";
cin >> x >> y >> z;
cout<< "Sum is : " << x + y + z << endl;
cout <<"Average is : " <<(x + y + z)/ 3 <<endl;
cout <<"Product is : "<<x* y* z << endl;
smallest = x;
if (y <smallest)
smallest = y;
if (z <smallest)
smallest = z;
cout <<"smallest is : " << smallest << endl;
largest = x;
if (y > largest)
largest = y;
if (z > largest)
largest = z;
cout <<"largest is : " << largest << endl;
return 0;
}

You might also like