lundi 11 juillet 2016

Better way to write this program?

I have written a program which is correct and gives the following output:

0     23     46     69       92
115    138    161    184
207    230    253    276    299
322    345    368    391
414    437    460    483
506    529    552    575    598
621    644    667    690
713    736    759    782
805    828    851    874    897
920    943    966    989
1012   1035   1058   1081
1104   1127   1150   1173   1196

My question is:- How can I improve this program to make it much better?

MY PROGRAM:

#include<stdio.h>
int main()
{
  int k,i,sum=0;

for(k=0;k<=11;k++)
{
   for(i=(100*k);i<=(100*k+99);i++)
   {
       if((i%23)==0)
       {
         printf("%6d",i);
       }
   }
   printf("\n");
 }
return 0;
}

Aucun commentaire:

Enregistrer un commentaire