For loop with init value, stop condition and incr
#include <stdio.h>
int main(void)
{
int i, j, k;
for( k = 0; k < 10; k = k + 1) {
printf("Enter a number: ");
scanf("%d", &i);
printf("Enter a non-zero number: ");
scanf("%d", &j);
if(j != 0)
printf("%d\n", i / j);
if(j == 0)
printf("Cannot divide by zero\n");
}
return 0;
}
Related examples in the same category