-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprogram7.c
56 lines (44 loc) · 1.41 KB
/
program7.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
//Write a program which checks whether number is divisible by 3 and 5.
#include <stdio.h> //for printff and scanf
#include <stdbool.h> // for bool data type
////////////////////////////////////////////////////////////////////////////
//
// Function Name: CheckEvenOdd
// Input: Integer
// Output: Boolean
// Description: Checks if input is divisible by 3 and 5
// Author: Swaraj Nitin Mhatre
// Date: 25/04/2023
//
///////////////////////////////////////////////////////////////////////////////
bool CheckDivisible(int iNo){
if(((iNo % 3) ==0) && ((iNo % 5)==0)){
return true;
}
else{
return false;
}
}
////////////////////////////////////////////////////////////////////////////////////
// Entry Point Function
////////////////////////////////////////////////////////////////////////////////////
int main(){
int iValue =0; //variable to accept input
bool bRet = false; //variable 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: ", iValue);
}
else{
printf("%d is not completely divisible by 3 and 5: ", iValue);
}
return 0;
}
/*
Logical Operators:
1 : Logical AND &&
2 : Logical OR ||
Expression1
*/