PF Assignment
PF Assignment
#include <iostream>
using namespace std;
void Perimetersq(int x, int y) {
cout << x * y;
}
void Perimeter(int a, int b) {
cout << a + a + b + b;
}
int main() {
int x = 0;
cout << " enter the value x to find the square ";
cin >> x;
cout << " enter the value of y to find the square";
int y = 0;
cin >> y;
cout << " value of area is ";
Perimetersq(x, y);
int a = 0;
cout << " Enter the value of a to find perimeter";
cin >> a;
cout << " Enter the value of b to find perimeter";
int b = 0;
cin >> y;
Perimeter(a, b);
#include <iostream>
using namespace std;
int findLargest (int num1, int num2, int num3)
{
int largest = num1;
if (num2 > largest)
{
largest = num2;
}
if (num3 > largest)
{
largest = num3;
}
return largest;
}
int main()
{
int num1, num2, num3;
cout << "The largest number is: " << largest << endl;
return 0;
}
#include <iostream>
using namespace std;
cout << "The smallest number is: " << smallest << endl;
return 0;
}
5- Take input of Diameter. Write a function to calculate area & perimeter of a circle.
#include <iostream>
using namespace std;
}
int main()
{
double diameter;
cout << "Enter the diameter of the circle: ";
cin >> diameter;
cout << "area of the circle: " << area << endl;
cout << "Perimeter of the circle: " << perimeter << endl;
return 0;