thor12395
thor12395 thor12395
  • 10-02-2022
  • Computers and Technology
contestada

write a program to input a number and print the largest and smallest number using c++.
please help fast​

Respuesta :

liamshilling
liamshilling liamshilling
  • 10-02-2022

Answer:

#include<stdio.h>

#include<limits.h>

void main()

{

int min,max,i,n,num;

min = INT_MAX;

max = INT_MIN;

 

printf("How many numbers do you want to enter: ");

scanf("%d",&n);

 

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

{

 printf("Number-%d: ",i+1);

 scanf("%d",&num);

 if(num>max) max = num;

 if(num<min) min = num;

}

 

printf("Smallest number = %d\nLargest number = %d",min,max);

}

Explanation:

Answer Link

Otras preguntas

Which best describes the main conflict of the novel? A. The dwarves lack confidence in Bilbo's abilities as a burglar and an adventurer. B. Gandalf trusts Bi
Literal equations Solve P=2(l+W) for l
Which step should be completed first to solve the equation --2 = 3z + 4 ? A. Add 2 to both sides. B. Subtract 4 from both sides. C. Divide both sides by 3.
Is this is correct ?? Please help lol
which point is on the line 4y-2x=0?a- (-2,-1)b- (-2,1)c- (-1-2)d- (1,2)
Which statement best describes why foreigners were eventually able to invade Egypt after Ramses II died? A. Struggles within the kingdom weakened the country a
what do we call resistance to disease?
List several species and several individual characteristics of dogs.
What are three functions of proteins?
At your grocery store, milk normally costs $3.60 per gallon. Ground beef costs $3 per pound. Today there are specials:Milk is discounted $.50 per gallon, and gr