Thursday, October 20, 2011

#3 Prosecna ocena od tri unete ocene

#include<conio.h>
#include<stdio.h>

 int oc1,oc2,oc3;
 double ocena;
 int zaokruzenaOcena;
 main(){
 
  printf("Program za racunanje prosecne ocene od tri unete ocene \n");
       
        printf("Molim vas unesite ocene\n");
       
        printf("ocena1="); scanf("%d",&oc1);
        printf("ocena2="); scanf("%d",&oc2);
        printf("ocena3="); scanf("%d",&oc3);
       
        printf("**** Prosecna ocena je ***\n\n");
        ocena=double((oc1+oc2+oc3+0.0)/3);
        printf("ocena=%f \n\n",ocena);
          if (ocena>=1 && ocena <2) printf("1 - nedovoljan \n");
            else if (ocena>=2 && ocena <=2.5) {
                  zaokruzenaOcena=2;
                  printf("%d - dovoljan \n", zaokruzenaOcena);
                  }
            else if (ocena>2.5 && ocena <=3.5) {
                  zaokruzenaOcena=3;
                  printf("%d - dobar \n",zaokruzenaOcena);
                  }
            else if (ocena>3.5 && ocena <=4.5) {
                  zaokruzenaOcena=4;
                  printf("%d - vrlodobar \n",zaokruzenaOcena);
                  }
            else if (ocena>4.6 && ocena <=5)  {
                  zaokruzenaOcena=5;
                  printf("%d - odlican \n",zaokruzenaOcena);
                  }
            else  printf("%f - Nije ocena \n",ocena);
           
            for (int i=0;i<7;i++){
                printf("%d prosecna ocena \n",zaokruzenaOcena);
               
                }      
       
 getch();      
 }

No comments:

Post a Comment