I wanna experiment on looping through a range of numbers that will be randomly inputted by the user. However, I don't want to let them see the loading percentage that is divisible by 4, so please exclude those for me when printing it out.
Thank you!
Instructions:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(){
int startingPoint,secondPoint;
//Input two integers in one line. The first inputted integer will be the starting point, and the second one shall serve as the ending point.
scanf("%d%d",&startingPoint,&secondPoint);
//Use the power of loops to loop through the starting point until the ending point (inclusive), and print out each number within the range with the corresponding format shown on the sample output.
for(int i=startingPoint;i<=secondPoint;i++){
//However, skip the printing of statement if the integer is divisible by 4.
if (i % 4 == 0){
continue;
}
printf("Loading...%d%\n",i);
}
getchar();
getchar();
return 0;
}
Comments
Leave a comment