PROGRAM NBilAsliPertama
DEKLARASI
j,n,i:integer
ALGORITMA
read (n)
j<-0
for (i=1; i<=n; i++)
j<-j+i
write (j)
endfor
KODING
#include<iostream>
using namespace std;
int main() {
int j,n,I;
cout<<"n="; cin>>n;
{j=0;}
for (int i=1; i<=n; i++)
{j=j+i;}
cout<<"N bilangan asli pertama="<<j<<endl;
system("PAUSE")
}
KELUARAN
Download program disini https://drive.google.com/file/d/1ig6LtXnw61SNE0CIi6xH24fC3Yzc_91m/view?usp=sharing
No comments:
Post a Comment