Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.  
  6.     int i, poz=0, neg=0, naj=0, broj, N;
  7.  
  8.     do {
  9.         printf("Unesite broj N u intervalu [6,24]\n");
  10.         scanf("%d",&N);
  11.             if (N < 6 || N > 24) {
  12.                 printf("Uneseni broj nije u tom intervalu!");
  13.             }
  14.     } while (N < 6 || N > 24);
  15.  
  16.     for (i=0; i<N;){
  17.         printf("Unesite broj:\n");
  18.         scanf("%d", &broj);
  19.  
  20.         if(broj==0) break;
  21.         if(broj%2==0){
  22.             printf("Broj je paran, ignorira se!!!");
  23.         } else {
  24.             if (broj < 0) {
  25.                 if (broj < naj) naj = broj;
  26.                 neg++;
  27.             }
  28.            
  29.             if (broj > 0) poz++;
  30.             i++;
  31.         }
  32.     }
  33.  
  34.         printf("\nUkupno ucitanih brojeva: %d",i);
  35.         printf("\nPozitivnih brojeva je: %d",poz);
  36.         printf("\nNegativnih brojeva je: %d",neg);
  37.         printf("\nNajmanji negativni broj je: %d",naj);
  38.         //printf("\nSljedeci po velicini broj je :");
  39.  
  40.     system("pause");
  41.     return 0;
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement