C - Write program to calculate remainder by dividing 5 from 1 to 30

Requirements

Write program to calculate remainder by dividing 5 from 1 to 30

Hint

Use Modulus remainder operator.

Demo

#include <stdio.h>

#define VALUE 5//from  w  w  w  . j a v a2 s . co m

int main()
{
    int a;

    printf("Modulus %d:\n",VALUE);
    for(a=0;a<30;a++)
        printf("%d %% %d = %d\n",a,VALUE,a%VALUE);
    return(0);
}

Result

Related Exercise