C Program to print the numbers from 1 to 50 divisible by 2 or 3


  1. /* This program prints the numbers from 1 to 50 divisible by 2 or 3 */
  2.  
  3. #include<stdio.h>
  4.  
  5. int main() {
  6.  
  7. int i;
  8.  
  9. printf("The numbers from 1 to 50 divisible by 2 or 3 are : \n");
  10.  
  11. for (i = 1 ; i <= 50 ; i++) {
  12. if ( i % 2 == 0 || i % 3 == 0) {
  13. printf("\t %d\n", i);
  14. }
  15. }
  16.  
  17. return 0;
  18. }

Comments