program for addition of fraction(M/N + P/Q = Y/Z)
Answer / sreejesh1987
#include<iostream.h>
#include<conio.h>
void main()
{
int m,n,p,q,y,z;
clrscr();
cout<<"\nEnter the numerator and denominator of fraction A: ";
cin>>m>>n;
cout<<"\nEnter the numerator and denominator of fraction B: ";
cin>>p>>q;
y=m*q+n*p;
z=n*q;
int d=(y<z)?y:z;
cout<<"\nSmaller of resultant's numbers: "<<d;
int i=2;
while(i<=d)
{
while((y%i)==0&&(z%i)==0)
{
y=y/i;
z=z/i;
}
i++;
}
cout<<"\nResulting fraction is: "<<y<<"/"<<z;
getch();
}
Is This Answer Correct ? | 5 Yes | 1 No |
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#
program for addition of fraction(M/N + P/Q = Y/Z)
How to pass multiple rows from one gridview to another gridview after clicking the checkbox.
How to Create Files by Using the FileInfo Class?
write a Program to copy the string using switch case.
How to add a value from textBox over an existing certain column in SQL Server
I am developing a web application using google map api.I want to update the map inside the div control within update panel. I got other controls updated but map doesn't get updated.I do not not want to update map whenever unnecessary controls are fired at server side.How could it be achieved?
Code for IP Address Comparison and Conversion in C#?
Write a program which has a function and that function should take 2 or 3 or any number of strings and it should return the largest common prefix of all those strings. If there is no common prefix it should return an empty string. for eg:- INPUT OUTPUT glo {glory,glorious,glod} gl {glad,glow} {calendar,phone} empty string
How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)
Coding for Manipulate XML File Data Using C#?
Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }