Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int n,i, j, k;
- printf(" Number of restaurants :") ;
- scanf("%d", & n) ;
- char str[20],str1[20]
- scanf("%s %d",str,&j);
- for(i=0;i<n;i++)
- {
- scanf("%s %d",str1,&k);
- if(j<k)
- {
- j=k;
- strcpy(str, str1);
- }
- else if(j==k && strcmp(str, str1)>0)
- {
- j=k;
- strcpy(str, str1);
- }
- }
- printf("%s",str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement