Showing 1 to 100 with line break at each 10

Display number 1 to 100
There should be linke break after 10, 20, 30 .... etc

We will use math fmod() or % to check the reminder of division by 10
#include <stdio.h>
int main(void){
int i;
for(i=1;i<=100;i++){

    printf("%d,",i);
	if((i%10)==0){
      printf("\n");
	}
}
return 0;
}
More on for loop.

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer