TUGAS 4.2

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; int main() { float luas, alas, tinggi; char name[20]; strcpy(name, "Rosdiana Fitriyani"); char hp[20]; strcpy(hp, "085717779465"); char nim[20]; strcpy(nim, "1620230020"); puts("--------------------------------------------------------"); cout<<"Program Menghitung Luas Segitiga"<<endl; puts("--------------------------------------------------------"); cout<<"Masukan nilai alas segitiga \t : \n"; cin>>alas; cout<<"Masukan nilai tinggi segitiga \t : \n"; cin>>tinggi; puts("--------------------------------------------------------"); cout<<"Luas Segitiga = (Alas * Tinggi) * 0.5"<<endl; luas = 0.5 * alas * tinggi; cout<<"Luas Segitiga = ("<<alas<<" * "<<tinggi<<") \t* 0.5"<<endl; printf("Luas Segitiga = %.2f \n", luas); puts("--------------------------------------------------------"); cout<<"Nama: "<<name<<endl; cout<<"HP : "<<hp<<endl; cout<<"Nim : "<<nim<<endl; puts("--------------------------------------------------------"); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines