Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int main()
- {
- int a;
- int b;
- int c;
- int d;
- int e;
- int f;
- int g;
- int h;
- int i;
- int j;
- int rezultat2;
- int rezultat3;
- int rezultat4;
- int rezultat5;
- int rezultat6;
- int rezultat7;
- int rezultat8;
- int rezultat9;
- int rezultat10;
- cout << "BINE ATI VENIT LA MEDIA ARITMETICA CU MAXIM 10 NUMERE!" << endl;
- cout << "DACA DORITI SA FACETI CU MAI PUTIN DE 10 NUMERE, ATUNCI INTRODUCETI 0 LA NUMARUL DUPA CARE DORITI SA VA OPRITI, IAR LA RESTUL 1" << endl;
- cout << "DE EXEMPLU DACA DORITI SA FACETI 2 NUMERE LA AL 3-LEA PUNETI 0 SI LA AL 4-LEA 1" << endl;
- cout << "Introduceti primul numar: ";
- cin >> a;
- cout << "Introduceti al doilea numar: ";
- cin >> b;
- cout << "Introduceti al treilea numar: ";
- cin >> c;
- cout << "Introduceti al patrulea numar: ";
- cin >> d;
- cout << "Introduceti al cincilea numar: ";
- cin >> e;
- cout << "Introduceti al saselea numar: ";
- cin >> f;
- cout << "Introduceti al saptelea numar: ";
- cin >> g;
- cout << "Introduceti al optulea numar: ";
- cin >> h;
- cout << "Introduceti al noualea numar: ";
- cin >> i;
- cout << "Introduceti al zecelea numar: ";
- cin >> j;
- if (c == 0);
- {
- rezultat2 = ( a + b ) / 2 ;
- cout <<"Media aritmetica a celor 2 numere este: "<< rezultat2;
- }
- else if (c == 0) {
- cout << " ";
- }
- if (d == 0);
- {
- rezultat3 = (a + b + c) / 3;
- cout <<"Media aritmetica a celor 3 numere este: "<< rezultat3;
- }
- else if (d == 0) {
- cout << " ";
- }
- if (e == 0);
- {
- rezultat4 = (a + b + c + d) / 4;
- cout << "Media aritmetica a celor 4 numere este:" << rezultat4;
- }
- else if (e == 0) {
- cout << " ";
- }
- if (f == 0);
- {
- rezultat5 = (a + b + c + d + e) / 5;
- cout << "Media aritmetica a celor 5 numere este:" << rezultat5;
- }
- else if (f == 0) {
- cout << " ";
- }
- if (g == 0);
- {
- rezultat6 = (a + b + c + d + e + f) / 6;
- cout << "Media aritmetica a celor 6 numere este:" << rezultat6;
- }
- else if (g == 0) {
- cout << " ";
- }
- if (h == 0);
- {
- rezultat7 = (a + b + c + d + e + f + g) / 7;
- cout << "Media aritmetica a celor 7 numere este:" << rezultat7;
- }
- else if (h == 0) {
- cout << " ";
- }
- if (i == 0);
- {
- rezultat8 = (a + b + c + d + e + f + g + h) / 8;
- cout << "Media aritmetica a celor 8 numere este: " << rezultat8;
- }
- else if (i == 0) {
- cout << " ";
- }
- if (j == 0);
- {
- rezultat9 = (a + b + c + d + e + f + g + h + i) / 9;
- cout << "Media aritmetica a celor 9 numere este: " << rezultat9;
- }
- else if (j == 0) {
- cout << " ";
- }
- if (j != 0);
- {
- rezultat10 = (a + b + c + d + e + f + g + h + i + j) / 10;
- cout << "Media aritmetica a celor 10 numere este: " << rezultat10;
- }
- else if (j != 0) {
- cout << " ";
- }
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment