Class_12_CS_Notes_ReportLab
Class_12_CS_Notes_ReportLab
1. Which of the following is equal to operator? b. == 2. The number of bytes reserved for a variable of
data type float is b. 4 3. Which operator is used for compound condition? d. Logical 4. Which of the
following is an arithmetic operator? b. % 5. Which one of the following is ignored during program
execution? b. Comment 6. What is the range of unsigned short integer? c. 0 to 65535 7. In C++ the
expression sum = sum + n can also be written as a. sum += n 8. How cursor is moved to the next
tabular position for printing data? b. By using manipulator 9. Which sign is used for logical AND? d. &&
10. Which one is called modulus operator? b. %
#include<iostream>
using namespace std;
int main() {
float f, c;
cout << "Enter Fahrenheit: ";
cin >> f;
c = 5.0/9 * (f - 32);
cout << "Celsius = " << c;
return 0;
}
#include<iostream>
using namespace std;
int main() {
float length, breadth, area;
cout << "Enter length and breadth: ";
cin >> length >> breadth;
area = length * breadth;
cout << "Area = " << area;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int a, b, c, d;
cout << "Enter four integers: ";
cin >> a >> b >> c >> d;
cout << "Sum = " << (a+b+c+d) << endl;
cout << "Product = " << (a*b*c*d) << endl;
cout << "Average = " << (a+b+c+d)/4.0;
return 0;
}
#include<iostream>
using namespace std;
int main() {
float base, height, area;
cout << "Enter base and height: ";
cin >> base >> height;
area = 0.5 * base * height;
cout << "Area = " << area;
return 0;
}