answersLogoWhite

0


Best Answer

#include<stdio.h>

void main()

{

int a[10],n,i,large,small;

printf("enter the value of n\n");

scanf("%d",&n);

printf("enter the elements\n");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

large=a[0];

small=a[0];

for(i=1;i<n;i++)

{

if(a[i]>large)

large=a[i];

if(a[i]<small);

small=a[i];}

printf("largest element in the array id %d\n",large);

printf("smallest element in the array is %d\n",small);

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to input 10 number array and find smallest and largest number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write program to read a set of real numbers and find the range is given by the difference between largest and smallest number?

Use the following algorithm (written in pseudocode). Let largest be the lowest possible real number. Let smallest be the greatest possible real number. Repeat while there is input... { Read real number r from input. If r is greater than largest then let largest be r. If r is less than smallest then let smallest be r. } End repeat. Let range be largest minus smallest. Output range.


Write a Shell program to find the smallest number from a set of numbers?

k


Given only one of each letter in the alphabet what are the smallest and largest number you could write down?

smallest: zero largest: five thousand


How to write a C program for left factoring?

Name two variables x and y. Divide the largest by smallest. If remainder is zero then the smallest is the HCF.


How can you download c compiler?

write a c program to fine largest/smallest of 3no (using ?:ternary operator/conditional operator)


Write a program that randomly fills a 10 component array then prints the largest and smallest values in the array?

final double[] ns = new double[10]; final Random rnd = new Random(System.currentTimeMillis()); // Fill... for (int i = 0; i &lt; ns.length; ++i) { ns[i] = rnd.nextDouble(); } // Get largest/smallest... double largest = Double.MIN_VALUE; double smallest = Double.MAX_VALUE; for (double n : ns) { if (n &gt; largest) { largest = n; } if (n &lt; smallest) { smallest = n; } } // largest and smallest are now the proper values.


What is the smallest 5 digit number you can write?

The smallest 5 digit number you can write is 10000.


What is the largest prime no that is stored in 8 bit pattern?

Write your own prime number program and find out.


Write the following numbers in order from smallest to largest 9.25 0.925 0.9 0.092 0.09?

just go the reverse of how they are listed now they are currently largest to smallest


How do you write a c program to find the smallest word in a string?

what is if(!(str[i]==32))


there are 3 number cards the numbers are hiddenThe mode of the 3 numbers is 7The highest number is not 7The range is 4 what are the 3 numbers write them from smallest to largest?

I believe the answer is: 7,7,11


Can you write a sentence using the names of the largest and the smallest continents?

Asia and Australia are continents.