Publicidad
Write a C++ program to ask the user to enter two integers a and b and.docx
Write a C++ program to ask the user to enter two integers a and b and.docx
Próximo SlideShare
Cuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docxCuilumber Candle Supply makes candles- The sales mix (as a percmtage o.docx
Cargando en ... 3
1 de 2
Publicidad

Más contenido relacionado

Más de lez31palka(20)

Publicidad

Write a C++ program to ask the user to enter two integers a and b and.docx

  1. Write a C++ program to ask the user to enter two integers a and b and find the gcd ( a,b ) using The Euclidean Algorithm. Write a C++ program to ask the user to enter two integers a and b and find the gcd ( a,b ) using The Euclidean Algorithm. Solution Answer: #include<iostream> #include<cstdlib> using namespace std; int greatestcommondivisor(int num1,int num2) { if((num1>=num2)&&((num1%num2)==0)) return(num2); else greatestcommondivisor(num2,(num1%num2)); } int main() { int num1,num2,output; cout<<"Enter first integer number:"; cin>>num1; cout<<"Enter second number:"; cin>>num2; output=greatestcommondivisor(num1,num2); cout<<"gcd of "<<num1<<" and "<<num2<<" is "<<output; return 0; }
Publicidad