What will the following program print for nesting if into for statement? - C Statement

C examples for Statement:if

Description

What will the following program print for nesting if into for statement?

Demo Code

#include <stdio.h> 
int main(void) 
{ 
  int num; //from w  w  w .  ja v  a 2 s  .  c  om
  for (num = 1; num <= 11; num++) 
  { 
       if (num % 3 == 0) 
            putchar('$'); 
       else 
            putchar('*'); 
            putchar('#'); 
       putchar('%'); 
  } 
  putchar('\n'); 
  return 0; 
}

Result


Related Tutorials