Advertisement
Qlynx

JUMLAH KARAKTER ANGKA

Sep 30th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. //CODING BY QLYNX
  5.  
  6. int main (){
  7.     char x;
  8.     int jml=0;
  9.     cout << "Input Karakter = ";cin >> x;
  10.     while (x !='.')
  11.     {
  12.         switch (x){
  13.             case '0': case '1': case '2':
  14.             case '3': case '4': case '5':
  15.             case '6': case '7': case '8':
  16.             case '9':
  17.             jml=jml+1;
  18.             break;
  19.         }
  20.        
  21.         cout << "Input Karakter = "<<x<< endl; cin >> x;
  22.     }
  23.     cout << "Jumlah Karakter Angka yang Diinput = " << jml << endl;
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement