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

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

  1. Profile photo of k v swaroop

    #include

    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\n”,num);
    }
    else
    {
    printf(“\nThe number %d is divisible by 3 but not by 5\n”,num);
    }
    }
    else
    {
    if(num%5==0)
    “tdiv.c” 31 lines, 507 characters

    ReplyReport user
  2. vivek rawat

    sir how can I make a program of that series:
    1-2+3-4+5-6…..n terms

    Reply
  3. a program in turbo c that accepts 20 numbers then display how many numbers are odd, even, and how many numbers are divisible by 3

    Reply
  4. write a java to find no. is divisible by 3 if it is then write c, also if it is divusible by 5 then write m and if both write cm
    Condition take no. of range from 1-100

    Reply
  5. ali hamad

    how i answer this question in c program
    “write a C program to get input in an array and add the numbers divisible by 11 and 46 .
    plz answer this question tomorrow the last day for submission , plz plz plz

    Reply

Leave a Reply