Tuesday, 3 April 2018

Program to display the numbers from 1 to 50 divisible by 2 and 3 but not divisible by 5


//Program to display the numbers from 1 to 50 divisible by 2 and 3 but not divisible by 5
#include<stdio.h>
#include<conio.h>
void main()
{
 int i,c=0;
 clrscr();
 printf("\n\n");
 printf("The Numbers between 1 to 50 divisible by 2 and 3\n");
 printf("and not divisible by 5 are\n\n");
 for(i=1;i<=50;i++)
 {
  if(i%2==0 && i%3==0 && i%5!=0)
  {
   printf("%d\t",i);
   c++;
  }
 }
 printf("\n\nTotal Numbers are = %d",c);
 getch();
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.