-
Notifications
You must be signed in to change notification settings - Fork 0
/
min_string3.c
48 lines (43 loc) · 961 Bytes
/
min_string3.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
#include<stdio.h>
#include<string.h>
int main()
{
char s1[40],s2[40],s3[40];
int i,c1=0,c2=0,c3=0;
printf("\nEnter first String:");
fgets (s1,40,stdin);
printf("\n Enter second String:");
fgets(s2,40,stdin);
printf("Enter third string:");
fgets(s3,40,stdin);
for(i=0;s1[i]!='\0';i++)
{
c1++;
}
printf("\n length of first string =%d",c1);
for(i=0;s2[i]!='\0';i++)
{
c2++;
}
printf("\n length of second string =%d",c2);
for(i=0;s3[i]!='\0';i++)
{
c3++;
}
printf("\n length of third string =%d",c3);
if(c1<c2&&c1<c3)
{
printf("\n First String is minimum.");
printf("\n String=%s",s1);
}
else if(c2<c1&&c2<c3)
{
printf("\n Second String is minimum.");
printf("\n String=%s",s2);
}
else
{
printf("\n third String is minimum.");
printf("\n String=%s",s3);
}
}