//fibonacci
#include#include
void main()
{
clrscr();
int i,a,b;
a=1;
b=1;
printf("%i,%i,",a,b);
for(i=1;i<=4;i++)
{
a=a+b;
b=b+a;
printf("%i,%i,",a,b);
}
getch();
}
#include
#include
void main()
{
clrscr();
int d,m,j;
printf("masukkan detik = "); scanf("%i",&d);
j=d/3600;
m=(d%3600)/60;
d=(d%3600)%60;
printf("jam adalah % i\n",j);
printf("menit adalah %i \n",m);
printf("detik adalah %i\n",d);
getch();
}
#include
#include
void main ()
{
clrscr ();
int a ;
printf ("masukan angka="),scanf("%i",&a);
switch (a)
{
case 1: printf ("januari\n");
printf ("satu\n");
printf ("I\n");
break;
case 2: printf ("februari\n");
printf ("dua\n");
printf ("II\n");
break;
case 3: printf ("maret\n");
printf ("tiga\n");
printf ("III\n");
break;
case 4: printf ("april\n");
printf ("empat\n");
printf ("IV\n");
break;
case 5: printf ("mai\n");
printf ("lima\n");
printf ("V\n");
break;
case 6: printf ("juni\n");
printf ("enam\n");
printf ("VI\n");
break;
case 7: printf ("juli\n");
printf ("tujuh\n");
printf ("VII\n");
break;
case 8: printf ("agustus\n");
printf ("delapan\n");
printf ("VIII\n");
break;
case 9: printf ("september\n");
printf ("sembilan\n");
printf ("IX\n");
break;
case 10: printf ("oktober");
printf ("sepuluh\n");
printf ("X\n");
break;
case 11: printf ("november\n");
printf ("sebelas\n");
printf ("XI\n");
break;
case 12: printf ("desember\n");
printf ("dua belas\n");
printf ("XII\n");
break;
default : printf ("only 1-12\n");
printf ("please try again!!!");
}
getch ();
}
#include
void main()
{
clrscr();
int i,ba,max,min;
float ttl,rt,a;
printf("banyak angka"); scanf("%i",&ba);
ttl=0;
rt=0;
max=-100;
min=100;
for(i=1;i<=ba;i++)
{
printf("angka %i= ",i); scanf("%f",&a);
ttl=ttl+a;
if (a>max)
max=a;
if (a
min=a;
}
rt=ttl/ba;
printf("total = %.2f\n",ttl);
printf("rata-rata=%.2f\n",rt);
printf("maxsimum=%i\n",max);
printf("minimum=%i",min);
getch();
}
#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();
}