Home > Back-end >  C language to write a program
C language to write a program

Time:11-14

Program, input from the keyboard 10 integers, find out the maximum number of 10 Numbers, and output the maximum number which one location in the array, urgent urgent

CodePudding user response:

This is the basic application of the array, first learned to write code

CodePudding user response:

 int nums [10]. 
//then assignment
Int index=0, maxint=nums [0].
For (int x=1; X<10; X++) {
If (maxint & lt; Nums [x]) {
The index=x;
Maxint=nums [x];
}
}
//how to output, write their own

Maxint is maximum in the array; The index is the location of the maximum value appeared, starting from 0,
Array elements could be the same, the code above will only remember the maximum first appeared,

Words, such a simple job would not begin, this is the contemporary college students?
  • Related