what is the output of the below mentioned program and I need step by step explanation
int main()
{
int n = 12 , res = 1;
while( n > 3)
{
n -= 3;
res *= 3;
}
printf("%d" , n*res);
}
Answers
Answered by
1
Answer:
81
Explanation:
while n>3 means it will stop even when n = 3
So, loop will run 3 times.
n = 12, 9, 6.
So, n = 3 as 6-3 = 3
and res = 1×3×3×3 = 27
So, n×res = 3×27 = 81
Similar questions