answersLogoWhite

0


Best Answer

To find the ratio of x and y, the formula is x/GCD(x,y) : y/GCD(x,y).

#include<stdio.h>

#include<conio.h>

int gcdrec(int ,int);

void main()

{

int x,y;

clrscr();

scanf("%d %d",&x,&y);

printf("Ratio = %d:%d",x/gcdrec(x,y),y/gcdrec(x,y));

getch();

}

int gcdrec(int a , int b)

{

return(b!=0 ? gcdrec(b,a%b) :a);

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

#include<stdio.h>

int main()

{

float a,b;

float c;

printf("Enter A and B values : ");

scanf("%f%f",&a,&b);

c=a/b;

printf("n The resultant value : %.2f",c);

return 0;

}

hi. u need to declare a and b valus as float other wise u get only Quotient. u will not get complete result (with decimal points)

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in C language to find the ratio of two numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Halstead's Software Science?

Halstead proposed the first analytic laws for computer science by using a set of primitive measures. these can be derived once the design phase is complected and the code is generated. these measures are listed below * n1= number of distinct operators in a program * n2= number of distinct operands in a program * N1= total numbers of operators * N2= total number of operandsBy using these measures,Halstead developed an expression for overall program length,program volume,program difficulty,development effort and so on.Program length (N) can be calculated by using equation:N = n1log2 n1 + n2log2 n2Program volume (V) can be calculated by using equation:V = N log2(n1+n2)Note that the program volume depends on the programming language used and respesents the volume of information (in bits) required to specify a program.Volume ratio (L) can be calculated by using the following equation:---- volume of the actual programWhere value of L must be less than 1. Volume ratio can be also calculated byProgram difficulty level (D) and effort(E) can be calculated by equations: D = (n1/2)*(N2/n2) E = D * V


Why do you have high level programming language?

High level programming languages offer a very high ratio of machine instructions over language expressions. In other words, a few high language statements can accomplish a lot, allowing the programmer to focus on solving the specific application's problem rather than reinventing the proverbial wheel or spending time with software engineering housekeeping duties.


What is voltage transformation ratio?

ratio of secondry voltage to primary voltage is called voltage transformation ratio


What is the standard ratio for inventory turnover ratio?

five


What range of values does intrinsic standoff ratio fall into?

The ratio of RB1 to RBBO is the intrinsic standoff ratio. It is the standoff voltage ratio to the power supply voltage.

Related questions