Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Dati N numeri, trovare maggiore e minore
- #include <stdio.h>
- int main(int argc, char const *argv[])
- {
- int N,i,x,mg,mn;
- printf("Quanti numeri vuoi inserire?\n");
- scanf("%d", &N);
- printf("Inserisci i tuoi numeri\n");
- scanf("%d", &x);
- mg = mn = x;
- for (i = 1; i < N; ++i){
- scanf("%d", &x);
- if(x < mn){
- mn = x;
- }else if (x > mg){
- mg = x;
- }
- }
- printf("Maggiore: %d\nMinore: %d\n", mg,mn);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement