Lab Manual 3
Lab Manual 3
#include <iostream>
using namespace std;
int main() {
cout << "Enter a number: ";
int number;
cin >> number;
int absoluteValue=number;
if (number < 0) {
absoluteValue = -number;
}
cout << "The absolute value of " <<
number << " is " << absoluteValue << endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
cout << "Enter a number: ";
int number;
cin >> number;
if (number % 2 == 0) {
cout << number << " is even." << endl;
} else {
cout << number << " is odd." << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
int age;
cout << "Enter your age: ";
cin >> age;
char citizenship;
cout << "Are you a citizen? (y/n): ";
cin >> citizenship;
return 0;
}
Task 01: Write a program in which it takes a number from keyboard as an input and if the
number is greater than 100 it prints “The number is greater than hundred”.
Task 02: Write a program in which it takes two numbers from keyboard as input and subtract
larger number from smaller.
Task 03: Write a program which take a number from keyboard and checks the number whether
that number is less than 100 or not if that number is less than 100 than check that is it less than
50 or not.
Task 04: Write a program which takes marks as input and shows the output as follows:
Greater than or equal to 75 : A
Greater than or equal to 60 : B
Greater than or equal to 45 : C
Less than 45 : Fail
PROGRAMMING FUNDAMENTALS
Task 05: Get gender, year of service and qualification of employee as input from keyboard and
determine his/her salary based on following chart.