Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int gcd (int a, int b)
4.
{
5.
int temp;
6.
while (b != 0) {
7.
temp = a % b;
8.
a = b;
9.
b = temp;
10.
}
11.
return(a);
12.
}
13.
int main ()
14.
{
15.
int x = 15, y = 25;
16.
cout
Options:
A .  15
B .  25
C .  375
D .  5
Answer: Option D

In this program, we are finding the gcd of the number.
Output:
$ g++ ret5.cpp
$ a.out
5



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers