You are on page 1of 7

University of

Engineering Technology &

Taxila

2020

[Computer Programming]

Department of Computer Engineering

Assignment No 2

SUBMITTED BY:
SHEIKH ABUZAR AMJAD
REG NO:
19-CP-6
SUBMITTED TO:
SIR SHEHRYAR KHAN
Task No 01:-
Write a C++ program to print your name, your date of birth, your
email address, your father name, your mobile number, your city
your department and any other information you want to display.
All these information should be in separate lines.
CODE
#include <iostream>
using namespace std;
int main()
{
cout<<"NAME: SHEIKH ABUZAR AMJAD"<<endl;
cout<<"Father Name: Amjad Iqbal"<<endl;
cout<<"Date of Birth: 09-01-2000"<<endl;
cout<<"Email: 19-CP-6@students.uettaxila.edu.pk"<<endl;
cout<<"Mobile No: 0307-9106436"<<endl;
cout<<"Department: Computer Engineering"<<endl;
cout<<"City: Vehari"<<endl;
return 0;
}

OUTPUT

1|Page
Task No 02:-
Write a computer program to add two numbers and display their
results on the screen.
CODE

#include <iostream>
using namespace std;
int main()
{
int num1,num2,result;
cout<<"Enter First number: "<<endl;
cin>>num1;
cout<<"Enter Second number: "<<endl;
cin>>num2;
result = num1 + num2;
cout<<"Result:"<<result<<endl;
return 0;
}
OUTPUT

2|Page
Task No 03:-
Write a C++ program to calculate the Celsius temperature
to Fahrenheit.
Algorithm
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
float fahrenheit, celsius;

cout << "Enter the temperature in Celsius : ";


cin >> celsius;
fahrenheit = (celsius * 9.0) / 5.0 + 32;
cout << "The temperature in Celsius : " << celsius << endl;
cout << "The temperature in Fahrenheit : " << fahrenheit << endl;
return 0;
}

OUTPUT

3|Page
Task No 04:-
Write a program to calculate the radius of the circle.
ALGORITHM
/* program to calculate the radius of the circle.*/
#include <iostream>
using namespace std;
int main()
{
float r,l,c;
float pi;
pi=3.1416;
l = 2*pi;
cout<<"Diameter:"<<l<<endl;
cout<<"Enter Circumference: "<<endl;
cin>>c;
r = c/l;
cout<<"Radius="<<r<<endl;
return 0;
}

OUTPUT

4|Page
Task No 05:-
Write a program in C++ by taking the amount in rupees
and convert it into dollars and print the result on the
screen.
ALGORITHM
/* Write a program in C++ by taking the amount in rupees and convert it into dollars
and print the result on the screen.*/
#include <iostream>
using namespace std;
int main()
{
float r,d;
cout<<"Enter amount in rupees ="<<endl;
cin>>r;
d = r/160.15;
cout<<"Amount in Dollars:"<<d<<endl;
return 0;
}
OUTPUT

5|Page
THE end

6|Page

You might also like