Quick actions

cmd+k|ctrl+k

Navigation

Languages

Algoritma2.2

Snippet info

Language

Cpp

Visibility

public

Author

afiful-rajab

Created

2024-10-22T14:18:01.103702Z

Updated

2024-10-22T14:18:01.103702Z

#include <iostream>
using namespace std;

//Nama : Muhammad Afiful Rajab
//Nim : 3420230016

int main() {
   
    
    int absen, tugas;
    float total;
    
    /* to store the result of a scanf operation on a regular variable, its name should be preceded by the reference operator (&) */
    printf("Masukan nilai absen : "); scanf("%d",&absen);
    printf("\nMasukan nilai tugas : "); scanf("%d",&tugas);
    
    /* ketika integer dibagi, hasil "/" operator adalah hasil bagi aljabar dengn pecahan dibuang */
    total = (absen + tugas) / 2;
    printf("\nNilai total adalah: %.2f", total);
    return 0;
}
INFO