asmnt-PF-LAB-1.docx - Q.1Write a program to print hello world on screen#include<iostream> using namespace std int main cfw cout <\"Hello World Q.2Write a

asmnt-PF-LAB-1.docx - Q.1Write a program to print hello...

This preview shows page 1 - 3 out of 6 pages.

Q.1Write a program to print “hello world” on screen. #include<iostream> using namespace std; int main() { cout << "Hello World”; } Q.2Write a program to display the following output using single cout statement. Subject Marks Mathematics 90 Computer 77 Chemistry 69 #include <iostream> using namespace std; int main() {cout << "Subject\tMarks\nMathematics\t90\nComputer\t77\nChemistry\t69\n"; } Q.3Write a program that accept two numbers and prints their sum. #include<iostream> using namespace std; int main() {int a,b,sum; cout<<”Enter first number:\n”; cin>>a; cout<<”Enter second number:\n”; cin>>b; sum= a+b; cout<<”Sum is “<<sum<<endl; Q.4Write a program which accepts temperature in Fahrenheit and prints it in celcius. #include <iostream> using namespace std; int main() { int f, frml; cout << "Enter the temperature in Fahrenheit" << endl; cin >> f; frml = (F-32)*5/9;
Image of page 1
cout << "The temp in C is "<<frml<<endl; } Q.5Write a program which accepts principle ,rate and time from user and print simple interest.
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 6 pages?

  • Fall '17
  • Following, ASCII, Carriage return, Ternary operation

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture