/*PROGRAM DERET BILANGAN MENGGUNAKAN ARRAY*/#pragma argused#include<iostream.h>#include<conio.h>
int main(){int data1[10];int data2[10];int i,x,jum1,jum2;jum1 = 0;jum2 = 0;cout<<"PROGRAM BILANGAN MENGGUNAKAN ARRAY"<<endl;cout<<"----------------------------------"<<endl;cout<<endl;cout<<"Masukkan Jumlah Bilangan(Max.10) : ";cin>> x ;cout<<endl;cout<<"Data Bilangan 1"<<endl;cout<<"---------------"<<endl;for ( i=1 ; i<=x ; i=i+1){cout<<"Data ke-"<<i<<" : ";cin>>data1[i];}cout<<endl;cout<<"Data Bilangan 2"<<endl;cout<<"---------------"<<endl;for ( i=1 ; i<=x ; i=i+1){cout<<"Data ke-"<<i<<" : ";cin>>data2[i];}cout<<endl;cout<<"Jumlah Bilangan 1 = ";for (i=1;i<=x;i=i+1){cout<<data1[i]<<" ";jum1=jum1+data1[i];}cout<<"= "<< jum1 <<endl;cout<<endl;cout<<"Jumlah Bilangan 2 : ";for (i=1 ; i<=x ; i=i+1){cout<<data2[i]<<" ";jum2=jum2+data2[i];}cout<<"= "<<jum2<<endl;getch();}
0 comments:
Post a Comment