blob: cc86b6bca1c33de0b7671c6c1692e3f1d7b56733 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Example 6.7
//The program illustrate the use of continue statement
disp("Enter 9999 to STOP");
count=0;
negative=0;
while(count<=100)
number=input("Enter a number:");
if(number==9999) then
break; //EXIT FROM THE LOOP
end
if(number<0),
disp("Number is negative");
negative =negative+1;
continue; //SKIP REST OF LOOP
end
sqrot=sqrt(number); //COMPUTE SQUARE ROOT
printf("Number = %f\n",number);
printf("Square root = %f",sqrot);
count=count+1;
end
//PRINT RESULTS
printf("Number of items done = %d\n",count);
printf("Negative items = %d\n",negative);
disp("END OF DATA");
|