SAP: 70172005
NAME: Syed M.Faseeh
Task-1
#include <iostream>
using namespace std;
int main() {
int num1, num2, sum;
num1 = 10;
num2 = 20;
sum = num1 + num2;
cout << "The sum of " << num1 << " and " << num2 << " is: " << sum << endl;
return 0;
}
SAP: 70172005
NAME: Syed M.Faseeh
Task-2
#include <iostream>
using namespace std;
int main() {
char myChar;
int myInt;
float myFloat;
double myDouble;
cout << "Size of char: " << sizeof(myChar) << " byte(s)" << endl;
cout << "Size of int: " << sizeof(myInt) << " byte(s)" << endl;
cout << "Size of float: " << sizeof(myFloat) << " byte(s)" << endl;
cout << "Size of double: " << sizeof(myDouble) << " byte(s)" << endl;
return 0;
}
SAP: 70172005
NAME: Syed M.Faseeh
Task-3
#include <iostream>
using namespace std;
int main() {
int decimalNumber;
cout << "Enter a decimal number: ";
cin >> decimalNumber;
cout << "Octal: " << oct << decimalNumber << endl;
cout << "Hexadecimal: " << hex << decimalNumber << endl;
return 0;
}
SAP: 70172005
NAME: Syed M.Faseeh
Task-4
#include <iostream>
using namespace std;
int main() {
char char1, char2;
cout << "Enter the first character: ";
cin >> char1;
cout << "Enter the second character: ";
cin >> char2;
int asciiSum = static_cast<int>(char1) + static_cast<int>(char2);
cout << asciiSum << endl;
return 0;
}
SAP: 70172005
NAME: Syed M.Faseeh
Task-5
#include <iostream>
using namespace std;
int main() {
int ascii_value;
cout << "Enter an ASCII value: ";
cin >> ascii_value;
cout << "Next five characters: ";
for (int i = 1; i <= 5; i++) {
cout << char(ascii_value + i) << " ";
cout << endl;
return 0;
SAP: 70172005
NAME: Syed M.Faseeh
Task-6
#include <iostream>
#define PI 3.14159
using namespace std;
int main() {
double radius, circumference;
cout << "Enter the radius of the circle: ";
cin >> radius;
circumference = 2 * PI * radius;
cout << "The circumference of the circle is: " << circumference << endl;
return 0;
SAP: 70172005
NAME: Syed M.Faseeh
Task-8
#include <iostream>
using namespace std;
int main() {
double celsius, fahrenheit;
cout << "Enter temperature in Celsius: ";
cin >> celsius;
fahrenheit = 1.8 * celsius + 32;
cout << "Temperature in Fahrenheit: " << fahrenheit << endl;
return 0;
SAP: 70172005
NAME: Syed M.Faseeh
Task-9
#include <iostream>
using namespace std;
int main() {
int hours, minutes, seconds, totalSeconds;
cout << "Enter hours: ";
cin >> hours;
cout << "Enter minutes: ";
cin >> minutes;
cout << "Enter seconds: ";
cin >> seconds;
totalSeconds = (hours * 3600) + (minutes * 60) + seconds;
cout << "Total time in seconds: " << totalSeconds << endl;
return 0;
SAP: 70172005
NAME: Syed M.Faseeh
Task-10
#include <iostream>
#include <string>
using namespace std;
int main() {
int sapID;
char firstName[20];
string lastName;
string fullName;
cout << "Enter SAP ID: ";
cin >> sapID;
cout << "Enter first name : ";
cin >> firstName;
cout << "Enter last name : ";
cin >> lastName;
cin.ignore();
cout << "Enter full name (getline function): ";
getline( cin, fullName);
cout << "\nSAP ID: " << sapID << endl;
cout << "First Name (char array): " << firstName << endl;
cout << "Last Name ( string): " << lastName << endl;
cout << "Full Name (getline function): " << fullName << endl;
return 0;