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

MUHAMMAD TALHA

SAPID:25362

LAB TASK(PF)
➢ Practice Task 1
Write a program to convert amount of rupees (Rs) into dollar ($). Program should take input from user in
rupees. External Knowledge: 1$=Rs. 160.40.

ANS
#include <iostream>
using namespace std;

int main() {
int rup,dol;
cout<<"Please your amount in rupees:::::::::"<<endl;
cin>>rup;
dol=rup/160;
cout<<rup<<"="<<dol<<"$"<<endl;
return 0;
}
Practice Task 2
Write a program to take two numbers as input data and display their sum, difference and product

ANS
#include <iostream>
using namespace std;
int main(void){

int a,b,sum,sub,mul;

cout<<"input first number please::::::::::::::::"<<endl;

cin>>a;

cout<<"input second number please::::::::::::::::"<<endl;

cin>>b;

sum=a+b;
sub=a-b;
mul=a*b;

cout<<"sum of the numbers is="<<sum<<endl;


cout<<"difference of the numbers is="<<sub<<endl;
cout<<"product of the numbers is="<<mul<<endl;

Practice Tasks 4
Take temperature in Fahrenheit as input from user and display in Celsius
C = (F - 32) * 5 / 9

ANS
#include <iostream>
using namespace std;
int main() {
int f,c;
cout<<"Please enter tempreture in fahrenhiet "<<endl;
cin>>f;
c=(f-32) * 5 / 9;
cout<<"Tempreture in celsius is ="<<c<<"c"<<endl;

return 0;
}

You might also like