-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.c
More file actions
38 lines (36 loc) · 807 Bytes
/
Copy pathcheck.c
File metadata and controls
38 lines (36 loc) · 807 Bytes
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
/*---------------------------------------------------------------------------------------
check.c
Program to check whether a given digit is present in a number or not
DIVYA RAJ.K
09-10-18
-----------------------------------------------------------------------------------------*/
#include<stdio.h>
main()
{
int Num,Ele,Flag=0,Rem;
system("clear");
printf("Program to check whether a given digit is present in a number or not\n");
printf("Enter an integer: ");
scanf("%d",&Num);
//N=Num;
printf("Enter a number: ");
scanf("%d",&Ele);
if(Ele>=10 || Ele<0){
printf("Invalid digit!!");
}else{
while(Num!=0){
Rem=Num%10;
if(Ele==Rem){
Flag=1;
break;
}
Num=Num/10;
}
if(Flag==1){
printf("The digit exists!!");
}
else{
printf("Digit does not exist!!");
}
}
}