What is Z after execution DELTAZ 05 Z10 DOFOR J 1 500 IF Z
What is Z after execution?
DELTA_Z = 0.5
Z=10
DOFOR J = 1, 500
IF Z + DELTA_Z > 40 THEN EXIT LOOP
Z = Z + DELTA_Z
ENDDO
Solution
Program:-
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
float z_delta=0.5;
float z=10;
for(int j=1;j<500;j++)
{
if(z+z_delta>40) {
break;}
else {
z=z+z_delta;}
printf(\"Value of z after execution is %f\",z);
getch();
}
Output:- Value of z after execution is 40.000000
