Kamis, 11 Maret 2021

Prakerja (newvideo.course-net.com) - Selection - 3.1 Selection if else

 /******************************************************************************

https://www.onlinegdb.com/online_c++_compiler

                              Online C++ Compiler.

               Code, Compile, Run and Debug C++ program online.

Write your code in this editor and press "Run" button to compile and execute it.


*******************************************************************************/


#include <stdio.h>


using namespace std;


int main()

{

    //Selection If else

    //if else, switch case

    

    int umur;

    printf("Masukan Umur : ");

    scanf("%d", &umur);fflush(stdin);

    

    //&& || untuk kondisi

    if(umur > 17 && umur < 21){

        printf("Remaja");

    }else{

        printf("Else.");

    }

    

    // if(umur > 17){

    //     printf("Anda Dewasa");

    // }else if (umur > 5 ) {

    //     printf("Anda Masih Kecil");

    // }else {

    //     printf("Anda Masih Bayi");

    // }

    

    

    return 0;

}


Tidak ada komentar:

Posting Komentar