#include
#include
void main()
{
int a,b;
clrscr();
printf("Enter 2 numbers:");
scanf("%d %d",&a,&b);
if(a>b)
printf("%d is greater than %d",a,b);
else
printf("%d is greater than %d",b,a);
getch();
}
Chat with our AI personalities
int largest_digit (int n)
{
int last, tmp;
if (n<10) return n;
last= n/10;
tmp= largest_digit (n/10);
if (last>tmp) tmp= last;
return tmp;
}
#include#includevoid main(){long int n,r,m,max=0,count=0;clrscr();printf("Enter the Number:");scanf("%ld",&n);m=n;while(n>0){r=n%10;if(r>max)max=r;n=n/10;}printf("\nLargest Digit is = %ld",max);while(m>0){r=m%10;if(r==max)count++;m=m/10;}printf("\n\nOccurence of Largest Digit %ld is = %ld",max,count);getch();}output:Enter the Number:68596999Largest Digit is = 9Occurence of Largest Digit 9 is = 4
program that take three decimal number as input and find the largest among them in assembly language
int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);
helicopter
160 and 192.