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 |
How to Create a Treeview Menu in ASP.NET with C#?
how do i copy textbox contents of 1 form to another form
IS Array list is generic or non generic
how can i split sting in textbox in windows application using c# .net
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.
Coding for using Nullable Types in C#?
how to change password in .net with c # with ado.net and also SQL server 2008 change password
program to reverse the order of digits in a given number of any length.
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); } }
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#
Code for Reading and writing from a file in c#?