Professional Documents
Culture Documents
Assignment 1 - Practice Questions Marks 10
Assignment 1 - Practice Questions Marks 10
Marks = 10
Practice the following questions on the compiler and paste the screen shot in
the document. Submit this document on LMS.
Note: Do not Copy Past
Task 1: Input three integer values from keyboard into variables a, b and c.
Code:
#include<iostream>
using namespace std;
int main()
{
int a, b, c;
cout << "Enter a value of a:";
cin >> a;
cout << "Enter a value of b:";
cin >> b;
cout << "Enter a value of c:";
cin >> c;
return 0;
}
Output:
int main()
{
int a, b, c;
cout << "Enter integer a and b values :";
cin >> a >> b; c = a * b;
cout << "a = " << a << ", b= " << b << endl;
cout << "c = " << c << endl;
return 0;
}
Output
Task 3: Write a program that calculates the square of a number entered by the
user and displays output as below.
Value Square
4 16
Code:
#include <iostream>
int main() {
return 0;
}
Output:
Task 4: What would be the output
int i=6, j=2;
cout<<i<<endl;
cout<<i++<<endl;
cout<<++i<<endl;
cout<<j++<<endl;
cout<<++i-j<<endl;
cout<<i-j--<<endl;
output:
**************************Best of Luck****************************