Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int mult (int x, int y)
4.
{
5.
int result;
6.
result = 0;
7.
while (y != 0) {
8.
result = result + x;
9.
y = y - 1;
10.
}
11.
return(result);
12.
}
13.
int main ()
14.
{
15.
int x = 5, y = 5;
16.
cout
Options:
A .  20
B .  25
C .  30
D .  35
Answer: Option B

 We are multiplying these values by adding every values.
Output:
$ g++ ret.cpp
$ a.out
25



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers