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 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..)
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
working with arrays
how to get the table names via c sharp and column names also?
How to Create a Treeview Menu in ASP.NET with C#?
Code for Reading and writing from a file?
Code for Working with Files under a Directory?
program to check if a number is "perfect number".
c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's.
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.
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
Can you declare an array of mixed Types?