Program to find out whether a entered number is divisible by 3 and 5 or not

This program find out whether a entered number is divisible by 3 and 5 or not.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "conio.h"
#include "stdio.h"
 
void main()
{
  int num;
  printf("\nEnter a number ");
  scanf("%d",&num);
  if(num%3==0)
  {
    if(num%5==0)
    {
      printf("\nThe number %d is divisible by 3 and 5");
    }
    else
    {
      printf("\nThe number %d is divisible by 3 but not by 5");
    }
  }
  else
  {
    printf("\nThe number %d is niether divisible by 3 nor by 5");
  }
getch();
}

Output:

Enter a number 21
 
Number is divisible by 3 but not by 5
Chitra
Chitra

2 thoughts on “Program to find out whether a entered number is divisible by 3 and 5 or not

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in