Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number

Answer Posted / aroosa naseer

import java.util.*;
class ArraysMax{
public static void main(String args[]){
int a[]=new int[10];
int max=0;
int temp;
Scanner scan=new Scanner(System.in);
System.out.println("Enter 10 numbers to find
out maximum");
for(int i=0;i<a.length;i++){
a[i]=scan.nextInt();
}
for (int i = 0; i < a.length; i++) {
while(a[i]>max){
max=a[i];
}

}
System.out.println("maximum number is= " + max);
}
}

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a simple calculator c program to perform addition, subtraction, mul and div.

3155


How can you relate the function with the structure? Explain with an appropriate example.

2923


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

504


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2867


Cluster head selection in Wireless Sensor Network using C programming language.

3114






Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

1783


3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

3323


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2337


How to palindrom string in c language?

8874


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2145


Write a routine to implement the polymarker function

4388


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2413


Sir... please give some important coding questions asked by product companies..

1805


why nlogn is the lower limit of any sort algorithm?

2381


Write a program to model an exploding firecracker in the xy plane using a particle system

3697