What is the output of the program, remainder operator? - C Operator

C examples for Operator:Modulus Operator

Description

What is the output of the program, remainder operator?

Demo Code

#include <stdio.h>

int main() {//from  w  w  w  . j a v  a 2 s. c  om
    int a[100], i, n = 35;

    for (i = 0; i <= n; i++)
        a[i] = i;

    for (i = 0; i < n; i++)
       printf("%6d%c", a[i], (i % 10==9 || i==n-1) ? '\n' : ' ');
    
    for (n=0; n <= 3; n++)
        printf("You have %d item%s.\n", n, n==1 ? "" : "s");

    return 0;
}

Result


Related Tutorials