-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount.c
More file actions
44 lines (31 loc) · 684 Bytes
/
count.c
File metadata and controls
44 lines (31 loc) · 684 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
39
40
41
42
43
44
#include<stdio.h>
int main(){
int select;
char str[1000];
int num;
int i = 0;
int cont = 0;
top:
printf("1. For string -> \n2. For integer -> \n99. To exit -> ");
scanf("%d",&select);
if(select == 1){
printf("Enter the string: ");
scanf("%c",&str);
printf("%d\n",sizeof(str)-1);
}else if(select == 2) {
printf("Enter the value of num: ");
scanf("%d",&num);
while(num>0){
num = num/10;
i++;
}
printf("%d\n",i);
}else if(select == 99){
goto exit;
}else{
printf("\n\nPlease choose correct option!\n");
goto top;
}
exit:
return 0;
}