Computer Science, asked by yashaswinirp07, 4 months ago

Find output of the below program:
#include<stdio.h>
void foo(int m)
{
int k=0;
while(m>0)
{
if(m%2—0)
{
k=k+4;
}
m=m-1;
if(m==k)
{
break;
}
}
printf("%d",k);
}
int main()
{
int x = 12;
foo(x);
return 0;
}​

Answers

Answered by mahi78972
0

Answer:

The final Output will be 8

Answered by SaurabhJacob
0

The output is,

                        8

  • foo() function is with a parameter in it.
  • It stores the passed in the variable 'm'.
  • The is a while loop used inside the function.
  • In which some operations are taking place.
  • Those operations in result output the value of 'k' as 8.
Similar questions