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
how to write a program that opens a file and display in reverse order?
We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character
write a program that reads a series of strings and prints only those strings begging with letter "b"
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
write a program using virtual function to find the transposing of a square matrix?
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n
find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L
Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
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
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.
how to diplay a external image of output on winxp by using c & c++,
create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file