Friday, April 9, 2021

20.17. Write a program that reads two string and display maximum.

#include<stdio.h>
#include<conio.h> 
#include<stdlib.h>
void main ()
{
char *a,*b,*max;
a=(int*)malloc(sizeof(int));
b=(int*)malloc(sizeof(int));
clrscr();
printf("Enter first string=");
scanf("%s", a);
printf("Enter second string=");
scanf("%s", b);
if(strcmp(a,b)>0)
strcpy(max,a);
else
strcpy(max,b);
printf("Maximum= %s",*c);
getch ();
}

No comments:

Post a Comment