Menentukan Jumlah Deret

Posted by Budi Arieyanto | Posted in | Posted on 02.43

#include<iostream.h>
#include<conio.h>

void main()
{
    int x;
   int jumlah=0;
   cout<<"masukkan bilangan = ";
   cin>>x;
   for(int i=0;i<=x;i++)
       {
          if (i % 2 == 0)
             jumlah=jumlah+i;
      }
   cout<<"Jumlah Deret adalah = "<<jumlah;
   getch();
}

Comments (0)

Posting Komentar