sahadat49

Largest number only

Aug 4th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. package largestnumberonly;
  2. import java.util.Scanner;
  3. public class Check {
  4. public static void main(String[] args){
  5. int a[] = new int[7];
  6. int i,j,max;
  7. Scanner sc = new Scanner (System.in);
  8. System.out.println("Enter your Numbers:");
  9. for(i=0;i<7;i++){
  10. a[i]=sc.nextInt();
  11. }
  12. max=a[0];
  13. for(i=0;i<7;i++){
  14. if(a[i]>max){
  15. max=a[i];
  16. }
  17. }
  18.  
  19. System.out.println("Largest Number = "+max);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment