Covert following expression into 'c': 9xy/p+1-1/3(m+n
Answers
Answer:
Explanation:
#include<stdio.h>
#include<conio.h>
void main()
{
int result,x,y,p,m,n;
clrscr();
printf("Enter the Value of x");
scanf("%d",&x);
printf("Enter the Value of y");
scanf("%d",&y);
printf("Enter the Value of p");
scanf("%d",&p);
printf("Enter the Value of m");
scanf("%d",&m);
printf("Enter the Value of n");
scanf("%d",&n);
result=(((9*x*y)/(p+1))-(1/(3*(m+n))));
printf("Result=%d",result);
getch();
}
Here is the required C program:
#include<stdio.h>
#include<conio.h>
int main()
{ int result=0,x,y,p,m,n;
//It is important to initialize result to avoid garbage value.
//Taking inputs for all the variables
printf("Enter the Value of x");
scanf("%d",&x);
printf("Enter the Value of y");
scanf("%d",&y);
printf("Enter the Value of p");
scanf("%d",&p);
printf("Enter the Value of m");
scanf("%d",&m);
printf("Enter the Value of n");
scanf("%d",&n);
//Following the precedence order of operators the result is formulated as:
result=(((9*x*y)/(p+1))-(1/(3*(m+n))));
printf("Result=%d",result);
return 0;
}