Page 1 :
LIST OF CPP PROGRAM, PROGRAM 1 : Write a program to print "Hello World", #include <iostream>, int main() {, cout << "HELLO WORLD";, return 0;, }, //OUTPUT, HELLO WORLD, PROGRAM 2 Write a program to print addition of two number, #include <iostream>, //using namespace std;, int main(), {, int a, b, c;, а,, cout << "Enter first number: ";, cin >> a;, cout << "Enter second number: ";, cin >> b;, Edit with WPS Office
Page 2 :
// sum of two numbers in stored in c, C = a + b;, // Prints sum, cout << a << " + " << b << " = " << c;, return 0;, }, // OUTPUT, Enter First Number: 4, Enter Second Number: 5, 4 + 5 = 9, PROGRAM 3 Write a program to print substraction of two number, #include <iostream>, //using namespace std;, int main(), {, int a, b, c;, cout << "Enter first number: ";, cin >> a;, cout << "Enter second number: ";, cin >> b;, // substraction of two numbers in storedc, c = a - b;, W Edit with WPS Office
Page 3 :
// Prints sub, cout << a << " - "., " = "<< c;, return 0;, }, // OUTPUT, Enter First Number: 14, Enter Second Number: 5, 14 - 5 = 9, PROGRAM 4 Write a program to print multiplication of two number, #include <iostream>, int main(), {, int a, b, c;, cout << "Enter first number: ";, cin >> a;, cout << "Enter second number: ";, cin >> b;, // multiplication of two numbers, C = a * b;, cout << a <<, "* ", << b<< ", " << C,, return 0;, }, // OUTPUT, Enter First Number: 4, W Edit with WPS Office
Page 4 :
Enter Second Number: 5, 4 * 5 = 20, PROGRAM 5 Write a program to print division of two number, #include <iostream>, int main(), {, int a, b, c;, cout << "Enter first number: ";, cin >> a;, cout << "Enter second number: ";, cin >> b;, // division of two numbers, c = a / b;, // Prints sum, cout << a << " /"<< b<< " = " << c;, return 0;, }, // OUTPUT, Enter First Number: 20, Enter Second Number: 5, 20/5= 4, PROGRAM 6 Write a program to print size of different data types., #include <iostream>, W Edit with WPS Office
Page 5 :
int main(), {, cout << "Size of char: " <<, sizeof(char), << " byte", << endl;, cout << "Size of int: " << sizeof(int) << "bytes" << endl;, cout << "Size of float: " << sizeof(float) << " bytes" << endl;, cout << "Size of double: "<< sizeof(double) << " bytes" << endl;, return 0;, }, //Output, Size of char: 1 byte, Size of int: 4 bytes, Size of float: 4 bytes, Size of double: 8 bytes, PROGRAM 7, Check Whether Number is Even or Odd using if else, #include <iostream>, using namespace std;, int main() {, int n;, W Edit with WPS Office