Hi
Please let me know why we are checking i%5 == 0 .Dont understand that bit .
#include<stdio.h>
main()
{
int i;
for (i = 1 ;i <= 20 ;i++)
{
printf("%10d", 1 + (rand() % 6));
if (i % 5 == 0)
printf("\n");
}
}
Thanks for your time and patience .
Hi
Please let me know why we are checking i%5 == 0 .Dont understand that bit .
#include<stdio.h>
main()
{
int i;
for (i = 1 ;i <= 20 ;i++)
{
printf("%10d", 1 + (rand() % 6));
if (i % 5 == 0)
printf("\n");
}
}
Thanks for your time and patience .
>Please let me know why we are checking i%5 == 0
% is the modulos operator. It is used here to output a newline character after every 5 iterations of the loop.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]