Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

helloooooaaa

Name: Anonymous 2011-10-09 16:11

what am i doing wrong here? or am i doing anything? im trying to get the average of the given 5 numbers.



#include<iostream>
using namespace std;



int main( )
 {
   
 int x, sum, counter, sonuc;
 sum = 0;
 counter = 0;
 

 
 
 cout<<"enter a number"<<endl;
 cin>>x;
 sum = sum + x;
 counter = counter + 1;
 
 if ( counter <= 5)
 
 cout<<"enter another number"<<endl;
 cin>>x;

else
 
 sonuc = sum/counter;
 cout<<"sonuc = ";
 cout<<sonuc<<endl;
 
  system("PAUSE");
 
 
   return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List