SHARE
TWEET

Untitled

a guest Nov 13th, 2018 222 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int main(int nrArgumente, char* argumente[]){
  3.    
  4.     //printf("nr argumente: %d\n", nrArgumente);
  5.     //printf("Arg 0: %s\n", argumente[0]);
  6.     //printf("Arg 1: %s\n", argumente[1]);
  7.    
  8.     int n1, n2, n3;
  9.     int k1, k2, k3;
  10.     float medieA, medieP;
  11.     char nume[20], prenume[20];
  12.    
  13.     // citirea datelor de la tastatura
  14.     printf("Introduceti numele si prenumele studentului: ");
  15.     scanf("%s%s", nume, prenume);
  16.     printf("Introduceti cele trei note: ");
  17.     scanf("%d%d%d", &n1, &n2, &n3);
  18.     printf("Introduceti nr de credite coresp celor trei note: ");
  19.     scanf("%d%d%d", &k1, &k2, &k3);
  20.    
  21.     // calcule
  22.     medieA = (float)(n1 + n2 + n3)/3;
  23.     medieP = (float)(n1*k1+n2*k2+n3*k3)/(k1+k2+k3);
  24.    
  25.     // afisarea rezultatelor
  26.     printf( "Studentul %s %s are media notelor: %.2f\n"
  27.             "media poanderata fiind: %.2f.", prenume, nume,
  28.             medieA, medieP);
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top