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

In one of her expeditions, a marine biologist finds a new organism that has an unsegmented, radially-symmetrical body with spiny skin. Under which phylum should
what is 6.2% as a fraction
Please answer the question from the attachment.
fitness can only be achieved through ?
Which equation is y= 6x^2 + 12x - 10
The intellectual property right that gives a creator control of his or her written work is known as what? A. citation B. copyright C. trademark D. public domain
African primary traded with what merchants along trans-saharan trade routes
Between 1978 and 1997 the price of gasoline increased from about $.65 a gallon to about $1.30. By what percent did the price of gasoline increase?
TRUE OR FALSE: When you are simply recording main ideas in your own words, there is no need to record the source and page numbers in your notes.
What are antibiotics