Quick actions

cmd+k|ctrl+k

Navigation

Languages

UAS NO.3

Snippet info

Language

Cpp

Visibility

public

Author

rifqiherdiyansah08

Created

2024-01-27T21:04:38.198026Z

Updated

2024-01-27T21:06:19.015022Z

#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

//Nama  : Muhammad Rifqi Herdiyansah
//Nim   : 3420220014
//Prodi : Teknik Informatika
using namespace std;

// Headers
string toString (double);
int toInt (string);
double toDouble (string);

int main() {
    int n;
    cin >> n;
    if (n % 2 == 0) {
        cout << "Bilangan Genap" << endl;
    } else {
        cout << "Bilangan Ganjil" << endl;
    }
    return 0;
}

// The following implements type conversion functions.
string toString (double value) { //int also
    stringstream temp;
    temp << value;
    return temp.str();
}

int toInt (string text) {
    return atoi(text.c_str());
}

double toDouble (string text) {
    return atof(text.c_str());
}
INFO