-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11B02.c
86 lines (72 loc) · 1.64 KB
/
11B02.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
77
78
79
80
81
82
83
84
85
86
#include<stdio.h>
void main()
{
int n;
int i;
int store;
int remainder;
int countrem;
int count1=0;
int count2=0;
int count3=0;
int count4=0;
int count5=0;
int count6=0;
int count7=0;
int count8=0;
int count9=0;
printf("Enter value of n : ");
scanf("%d",&n);
for ( i = 0; n!=0; i++)
{
remainder=n%10;
countrem=remainder;
n=n/10;
if (countrem==1)
{
count1=count1+1;
}
else if (countrem==2)
{
count2=count2+1;
}
else if (countrem==3)
{
count3=count3+1;
}
else if (countrem==4)
{
count4=count4+1;
}
else if (countrem==5)
{
count5=count5+1;
}
else if (countrem==6)
{
count6=count6+1;
}
else if (countrem==7)
{
count7=count7+1;
}
else if (countrem==8)
{
count8=count8+1;
}
else if (countrem==9)
{
count9=count9+1;
}
}
printf("Frequency of input digit\n");
printf("1=%d\n",count1);
printf("2=%d\n",count2);
printf("3=%d\n",count3);
printf("4=%d\n",count4);
printf("5=%d\n",count5);
printf("6=%d\n",count6);
printf("7=%d\n",count7);
printf("8=%d\n",count8);
printf("9=%d\n",count9);
}