Lab REPORT 09
Lab REPORT 09
LAB REPORT # 8
NAME: Abdul Wahab
DEGREE: 42
SYNDICATE:C
DEPARTMENT: Mechanical Engineering
COURSE: CS-114 Fundamentals of Programming
PROGRAM # 1
***CODE:
#include<iostream>
using namespace std;
float area(float rad)
{
float result=1;
result = rad * 3.141592653589793238;
cout << "The Area of Circle = ";
return result;
}
float main()
{
float a ;
cout << "Enter Radius of Circle : ";
cin >> a;
cout << area(a);
return 0.0 ;
}
***OUTPUT:
PROGRAM # 2
***CODE:
#include<iostream>
using namespace std;
bool oetest(int num)
{
int result = 1;
cout << "The Required bol. type is : ";
if (num % 2 == 0)
{
cout << "1" << endl;
}
if (num % 2 == 1)
{
cout << "0" << endl;
}
return 0;
}
int main()
{
int a;
cout << "Enter Any Number : ";
cin >> a;
cout << oetest(a);
return 0;
}
***OUTPUT:
PROGRAM # 3
***CODE:
#include<iostream>
using namespace std;
int power(int base, int exp)
{
int result=1;
for (int a=0; a < exp; a++)
{
result = result * base;
}
cout << "The Result = ";
return result;
}
int main()
{
int a, b;
cout << "Enter Base of Number : ";
cin >> a;
cout << "Enter Exponent of Number : ";
cin >> b;
***OUTPUT:
PROGRAM # 4
***CODE:
#include<iostream>
using namespace std;
int swap(int a, int b)
{
cout << "The First Number is = " << b << endl;
cout << "The Second Number is = " << a << endl;
return 0;
}
int main()
{
int a, b;
cout << "Enter First Number : ";
cin >> a;
cout << "Enter Second Number : ";
cin >> b;
cout << swap(a, b);
return 0;
}
***OUTPUT: