Write a java program to pass an integer as argument and print the second largest digit.
Answers
Answered by
7
Explanation:
Interview Answer. ▼ while (num>0) { int dig = num % 10; if(dig > largest) { ▼ while(n){ x=n%10; if(max1x) max2=x; n=n/10; ▼ #include. using namespace std; int main() { ▼ Simple 1(Java) *************** public class Digitna { /** ▼ import java.util.*; class Codechef. { public static void main (String[] args.
Answered by
4
Answer:
here's your answer
Explanation:
Hide Copy Code
#include <stdio.h>
#include <stdlib.h>
#include<limits.h>
int main()
{
int n;
printf("Enter the number : ");
scanf("%d",&n);
int min=INT_MIN,temp;
while(n!=0)
{
temp = n % 10;
if(temp>min)
min=temp;
n = n/10;
}
printf(" large",min);
return 0;
}
Similar questions