#include <stdio.h>
void main()
{
int p, q, r, s;
float ratio;
printf("\n Enter four integers ( seperates by space): ");
scanf("%d %d %d %d", &p, &q, &r, &s);
if ( (r-s) == 0 )
{
printf("\n Ratio is infinity, because (r-s) is 0.");
exit(0);
}
else
{
ratio = (float)(p+q) / (float) (r-s);
printf("\n Ratio is %.2f", ratio);
}
return 0;
}
void main()
{
int p, q, r, s;
float ratio;
printf("\n Enter four integers ( seperates by space): ");
scanf("%d %d %d %d", &p, &q, &r, &s);
if ( (r-s) == 0 )
{
printf("\n Ratio is infinity, because (r-s) is 0.");
exit(0);
}
else
{
ratio = (float)(p+q) / (float) (r-s);
printf("\n Ratio is %.2f", ratio);
}
return 0;
}
No comments:
Post a Comment