TOLONG BANTU DONG KAKAK
Jawaban:
C) #include <iostream>
int main()
{
int x;
std::cout << "Masukkan nilai X: ";
std::cin >> x;
if (x < 0)
{
std::cout << "Bilangan Negatif" << std::endl;
}
else if (x > 0)
{
std::cout << "Bilangan Positif" << std::endl;
}
else
{
std::cout << "Bilangan 0" << std::endl;
}
return 0;
}
D) #include <iostream>
int main()
{
int nilai;
std::cout << "Masukkan nilai: ";
std::cin >> nilai;
if (nilai >= 81 && nilai <= 100)
{
std::cout << "A" << std::endl;
}
else if (nilai >= 71 && nilai < 81)
{
std::cout << "B" << std::endl;
}
else if (nilai >= 61 && nilai < 71)
{
std::cout << "C" << std::endl;
}
else if (nilai >= 51 && nilai < 61)
{
std::cout << "D" << std::endl;
}
else if (nilai < 51)
{
std::cout << "E" << std::endl;
}
else
{
std::cout << "Nilai salah" << std::endl;
}
return 0;
}
Penjelasan: