Computer C++ program to find the LCM and GCD of two numbers 2011
Computer C++ program to find the LCM and GCD of two numbers
#include
#include
void main()
{
clrscr();
int x,y,gcd=1;
cout<>x;
cout<>y;
for(int i=1;i<1000;++i)
{
if((x%i==0)&&(y%i==0))
gcd=i;
}
cout<<"nnnGCD :"<
cout<<"nnnLCM :"<<(x*y)/gcd;
getch();
}
OUTPUT:
ENTER 1st NO : 12
ENTER 2nd NO. :13
GCD :1
LCM :156
why we use the 1000 as a limit in this problem.
and if we use this expression(i<= (x||y) on the place of 1000 is true ora noot
Write a program that creates a one-dimensional array which can hold 10 numbers and fill the array with integer values given by the user. The output of the program should display the 10 array elements, and the output of the following functions.
• MinVal() function which returns the smallest value in the array.
• MaxVal() function which returns the largest value in the array.
• Sum() function which returns the sum of all the numbers in array.
• Duplicate() function which prints the repeated value in the array.
• Avg() function which returns the average of all numbers in the array. You should call the Sum() function (implemented earlier) within this function.
• printReverse() function which displays the array elements in reverse order.
Write a menu-driven main function which calls all of the above functions using a switch statement.
please please do solve these questions. i need them by tomorrow if possible.
Write a function called zerosmaller() that is passed two int arguments by reference and then sets the smaller of the two numbers to 0. Write a main() program to exercise this function and also check the effect of pass-by-reference by displaying the values of both arguments after calling the function.
void zerosmaller (int& a, int& b)
Use the same logic and implement another function called zerolarger() which sets the larger of the two numbers to zero.
what is the result of cout<>y; and cout<>x; in the above program?
Computer C++ program to find the LCM of two numbers using call by reference
what is meant by class ,function ,variable,declaration of variable,how to declare variable,initialization,constructor,destructor,defined,implicitly declaration,explicit declaration,access specifiers?
i need a project based on gui aplication…..would u like to send me ……..i really need it…..please help
assuming that there are 7.481 gallons in cubic foot,write a c++ program that asksthe user to enter the number of gallons and then display the equivalent in cubic feet.
Lol Its Not working Bro !
Ahahahahhaha
Error: Your comment is too short. Please try to explain your query.