0% found this document useful (0 votes)
18 views

Muhammad Talha SAPID:25362: Practice Task 1

Uploaded by

Muhammad Talha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Muhammad Talha SAPID:25362: Practice Task 1

Uploaded by

Muhammad Talha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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