#include <stdio.h>
int main() {
int n;
do {
printf("Enter a Number :");
scanf("%d", &n);
printf("%d \n", n);
if (n % 7 == 0) {
break;
}
} while (1);
printf("Program Ends");
return 0;
}
Why the problem run for infinite time for input of any character?
I want to know why it is happening? It should break from the loop because character is not divisible by 7?
scanf. Read from docs (like, just google "C scanf") what the return value means.