88. Program to accept two strings and biggest among them
Code:
#include<stdio.h>
#include<conio.h>
int getline(char line[],int lim);
main( )
{
char str1[80],str2[80];
int len1,len2;
clrscr( );
printf(“enter first string”);
len1=getline(str1,80);
printf(“enter second string”);
len2=getline(str1,80);
if(len1 >len2)
printf(“first string bigger than second string”);
else
if(len1<len2)
printf(“second string bigger than first string”);
else
printf(“both strings are equal”);
getch( );
}
int getline(char line[],int lim)
{
int i;
for(Ii0;i<lim && ((line[i]=getchar( ))!=’\n’);i++)
if(line[i]==’\n’)
line[i]=’\0’;
return i;
}
All materials on the site are licensed Creative Commons Attribution-Sharealike 3.0 Unported CC BY-SA 3.0 & GNU Free Documentation License (GFDL)
If you are the copyright holder of any material contained on our site and intend to remove it, please contact our site administrator for approval.
© 2016-2025 All site design rights belong to S.Y.A.