How many times will the while loopbe executed for the given pseudocode
character obj = 125,
while(obj<128)
{
print obj
obj = obj + 1
}
Answers
Answered by
20
3 times
Explanation:
- We can find the number of times the while loop executed by writing a program.
Program:
#include <stdio.h>
int main() {
int obj = 125;
int times=0;
while(obj<128)
{
printf("%d\t",obj);
obj = obj + 1;
times++;
}
printf("\n\nThe while loop executed %d times.",times);
return 0;
}
Refer the attached image for the output.
Attachments:
Similar questions