Problem 1
/ program to print a sentence
#include <iostream>
using namespace std;
int main() {
cout << "Hello world." << endl;
return 0;
}
//program to find a integer entered by user
#include <iostream>
using namespace std;
int main() {
int num;
cout << "Enter a number: ";
cin >> num;
cout << "You entered: " << num << endl;
return 0;
}
Problem 3
#include <iostream>
using namespace std;
int main() {
int a, b;
cout << "Enter number 1: ";
cin >> a ;
cout << "Enter number 2: ";
cin >> b;
cout << "Sum: " << a + b << endl;
return 0;
}
// program to find ascii value
#include <iostream>
using namespace std;
int main() {
char c;
cout << "Enter a character: ";
cin >> c;
cout << "ASCII Value of " << c << " is " << (int)c << endl;
return 0;
}
// program t find quotient value and reminder
#include <iostream>
using namespace std;
int main() {
int dividend, divisor;
cout << "Enter dividend : ";
cin >> dividend ;
cout << "Enter divisor: ";
cin >> divisor;
cout << "Quotient: " << dividend / divisor << endl;
cout << "Remainder: " << dividend % divisor << endl;
return 0;
//program to multiply two floating numbers
#include <iostream>
using namespace std;
int main() {
double x, y;
cout << "Enter number1: ";
cin >> x ; cout << "Enter two number2: ";
cin >> y;
cout << "Product: " << x * y << endl;
return 0;
}
//program to multiply two floating numbers
#include <iostream>
using namespace std;
int main() {
double x, y;
cout << "Enter number1: ";
cin >> x ; cout << "Enter two number2: ";
cin >> y;
cout << "Product: " << x * y << endl;
return 0;}
// program t find quotient value and reminder
#include <iostream>
using namespace std;
int main() {
int dividend, divisor;
cout << "Enter dividend : ";
cin >> dividend ;
cout << "Enter divisor: ";
cin >> divisor;
cout << "Quotient: " << dividend / divisor << endl;
cout << "Remainder: " << dividend % divisor << endl;
return 0;
}
// program to swap numbers
#include <iostream>
using namespace std;
int main() {
int a, b, temp;
cout << "Enter a and b: ";
cin >> a >> b;
temp = a;
a = b;
b = temp;
cout << "After swapping: a = " << a << ", b = " << b << endl;
return 0;
}
// program to check even or odd
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter a number: ";
cin >> n;
if (n % 2 == 0) cout << "Even";
else cout << "Odd";
return 0;