On Sunday, April 21, 2013

Mencari nilai faktorial dengan menggunakan perulangan for:

#include<iostream.h>
main()
{int a=1, b, nil;
cout<<"input angka = ";cin>>nil;
cout<<nil<<"!=";
  for(b=1;b<nil;b++)
    {a*=(nil-1);
      if(b!=1)
         {cout<<b<<"x";}
      else
         {cout<<b<<"="<<a;}
    }
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Copyright © Welcome here ~ | Green Minimalist Theme |Powered by Blogger | Designed by Johanes DJ