Write a program using two-dimensional arrays that determines
the highest and lowest of the 12 input values.
Example:
Enter 12 numbers:
13 15 20 13 35 40 16 18 20 18 20 14
highest: 40
lowest: 13
Answer Posted / sreejesh1987
// Why 2D array? Solution with 1D array
#include<stdio.h>
#include<conio.h>
void main()
{
int i,a[11],min,max;
clrscr();
printf("Enter Twelve numbers:");
for(i=0;i<12;i++)
scanf("%d",&a[i]);
min=max=a[0];
for(i=0;i<12;i++)
{
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];
}
printf("\nHighest:%d,Lowest:%d",max,min);
getch();
}
Is This Answer Correct ? | 35 Yes | 18 No |
Post New Answer View All Answers
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?
i don't know about working of nested for loop can any one help me
write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.
Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.
what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }
write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation
write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20
Code for Easily Using Hash Table?
write a program that reverses the input number of n.Formulate an equation to come up with the answer.
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
develop a program to calculate and print body mass index for 200 employees
How to swap two ASCII numbers?