Write a CC program that uses if and else if statements to ca
Solution
//Following is the C++ program for the problem statement 5.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x,y;
int f1=0,f2=0,f3=0,f4=0;
cout<<\"Enter the value of x and y\ \";
cin>>x>>y;
if(x>0 && y>0)
f1=x*2+y*y;
else if(x>0 && y<=0)
f2=pow(3,((x-y)/(x+y)));
else if(x<=0 && y>=0)
f3=pow(x+y,(x*x-y*y*y)/(x+y)*(x-y));
else if(x<=0 && y<=0)
f4=pow((x*y)/(x-y),x*y/3);
cout<<\"Value of F1 :\"<<f1<<\"\ \";
cout<<\"Value of F2 :\"<<f2<<\"\ \";
cout<<\"Value of F3 :\"<<f3<<\"\ \";
cout<<\"Value of F4 :\"<<f4<<\"\ \";
return 0;
}
//Output:
~$ g++ first.cpp
~$ ./a.out
Enter the value of x and y
2
3
Value of F1 :13
Value of F2 :0
Value of F3 :0
Value of F4 :0
~$ ./a.out
Enter the value of x and y
2
0
Value of F1 :0
Value of F2 :3
Value of F3 :0
Value of F4 :0

