Computer Science, asked by blackshroud47, 6 months ago

write a program to
input two numbers and display the largest number / smaller number

Answers

Answered by codecracker
27

Answer:

int a=5,b=6;

if(a>b)

printf("%d is greater",a);

else

printf("%d is greater",b);

Answered by qwvilla
0

//Writing java code for the program

import java.util.*;

class compare

{

public static void main(String args[])

{

int a,b;

Scanner sc = newScanner(System.in);

System.out.println("Enter a number :");

a = sc.nextInt();

System.out.println("Enter another number :");

b = sc.nextInt();

if (a>b)

System.out.println("The larger number is " + a + " and the smaller number is " + b );

else

System.out.println("The larger number is " + b + " and the smaller number is " + a );

}

}

#SPJ3

Similar questions