-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram7.c.c
76 lines (53 loc) · 1.8 KB
/
Program7.c.c
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//Write a program which checks whether number is dividible by 3 and 5
#include<stdio.h> //for printf and scanf
#include<stdbool.h> //for bool data type or(typedef)
/////////////////////////////////////////////////////////////////////////
// Funtion name: CheckDivisible
// Input: Integer
// Output: Boolean
// Description: Checks whether input is divisible by 3 and 5
// Author: Shruti Vaibhav Bartakke
// Date: 25/04/2023
// Update Date:
////////////////////////////////////////////////////////////////////////
bool CheckDivisible(int iNo) //checkEvenOdd() in java
{
if(((iNo % 3)==0) && ((iNo % 5)==0))
{
return true;
}
else
{
return false;
}
}
//////////////////////////////////////////////////////////////////////////
//Entry point function
/////////////////////////////////////////////////////////////////////////
int main()
{
int iValue = 0; //local var to acccept input
bool bRet = false; //var to accept return value
printf("Please enter number to check whether it is divisible by 3 AND 5: \n");
scanf("%d",&iValue);
bRet = CheckDivisible(iValue); //function call
if(bRet == true)
{
printf("%d is completely divisible by 3 and 5\n",iValue);
}
else
{
printf("%d is not completely divisible by 3 and 5\n",iValue);
}
return 0;
}
/*
Logical Operators
AND &&
OR ||
Expression 1 Expression 2 && ||
true true true true
true false flase true
false flase false false
false true false true
*/