Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //IFF - Introdução à Programação
- //Slide - Página 32 - Exercício 2
- #include<stdio.h>
- #include<locale.h>
- int main(){
- setlocale(LC_ALL,"Portuguese");
- int i,n,num,maior,menor;
- printf("Entre com a quantidade de números que serão inseridos: ");
- scanf("%d",&n);
- for (i=0;i<n;i++){
- printf("Entre com o %dº valor: ",(i+1));
- scanf("%d",&num);
- if(i==0){
- maior=num;
- menor=num;
- }
- if(maior<num) maior=num;
- if(menor>num) menor=num;
- }
- printf("O maior valor foi %d e o menor foi %d.",maior,menor);
- }
Advertisement
Add Comment
Please, Sign In to add comment