RSS

Media aritmetică versiunea 3.0

03 Apr

Algoritm îmbunătăţit din nou după indicaţiile lui zaqk :

#include<iostream.h>
#include<conio.h>
int main( )
{ int n,i,suma=0,numar=0;
float media;
cout<<"n= "; cin>>n;

for(i=1;i<=n;i++)
{ cout<<"v["<<i<<"]=";
cin>>numar;
suma=suma+numar; }
 
media= (float) suma/n;
cout<<"Media aritmetica a numerelor introduse este: "<<media;
getch( ); }

 
2 Comments

Posted by on April 3, 2011 in Uncategorized

 

Tags: ,

2 responses to “Media aritmetică versiunea 3.0

  1. r4dhu

    April 3, 2011 at 00:13

    L-am modificat bine, zaqk ?

     
  2. zaqk

    April 3, 2011 at 07:21

    🙂
    simplu si eficient🙂

     

Lasă un comentariu

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: