contoh program mencari total,rata rata, min. max,input berhenti apabila 0

#include
#include
void main()

{
clrscr();
int a,ba,min,max;
float rt,ttl;
max=0;
min=100;
ttl=0;
ba=0;
do
{
printf(“masukkan angka”);scanf(“%i”,&a);
if(a>max)
max=a;
if(a
min=a;
ba=ba+1;
ttl=ttl+a;
}
while(a!=0);
rt=ttl/ba;
printf(“total=%.2f\n”,ttl);
printf(“minimal=%i\n”,min);
printf(“maximal=%i\n”,max);
printf(“rata rata=%.2f\n”,rt);
getch();
}

About Nobel kurniadi

hello i'm nobel who are you?

Posted on September 23, 2011, in Pemrograman. Bookmark the permalink. Leave a comment.

Leave a Reply

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: