4.1
Problem : Rearrange the elements in an array so that they appear in reverse order.
penyelesaian dengan menggunakan dev c++ :
penyelesaian dengan menggunakan dev c++ :
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
char balik[10]="123456789";
cout<<"Kata Awal: ";
for(int i=0;i<10;i++){
cout<<balik[i];
}
cout<<endl;
cout<<"Di Balik :";
for(int i=10; i>=0; i--){
cout<<balik[i];
}
return 0;
}

Komentar
Posting Komentar