C++ :
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
cout<<"latihan perulangan c++"<<endl;
cout<<"menampilkan angka 1 sampai 10 = ";
for(int i=0;i<=10;i++){
cout<<i;
}cout<<endl;
cout<<"menampilkan angka genap =";
for(int i=0;i<=10;i++){
i%2==0;
cout<<i;
i++;
}
cout<<endl;
cout<<"menampilkan angka ganjil =";
for(int i=0;i<=10;i++){
i%2!=0;
cout<<i+1;
i++;
}
return 0;
}
OUTPUT C++ :
0 komentar:
Posting Komentar