Write a program that reads two positive integer values X and Y. The program must then calculate and display the result of the following expression :
\(\frac{(X^2+1)(\frac{X}{Y}-3)}{(X-Y^2)(Y^2-X)}\)
Difficulty level

Video recording
This exercise is mostly suitable for students
#include <stdio.h>
int main()
{
int X, Y ;
do{
printf("Enter 2 positive integers: ");
scanf("%d %d", &X, &Y);
}while(X<0 || Y<0);
if( (X-Y*Y)*(Y*Y-X) !=0 )
printf("Answer %d %d =%.2lf\n", X, Y ,((X*X+1) * (1.0*X/Y -3)) / (1.0*(X-Y*Y)*(Y*Y-X)) );
else
printf("No solution\n");
return 0;
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
