Search This Blog

Contoh operator aritmatika bahasa C (input angka sendiri)

Operator aritmatika bahasa C (input angka sendiri)

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int num1,num2;
    int add,subs,mul,div,mod;

    printf("Enter first number :");
    scanf("%d",&num1);
    printf("\nEnter second number :");
    scanf("%d",&num2);

    add=num1+num2;
    printf("\nAddition is = %d",add);

    subs=num1-num2;
    printf("\nSubtraction is = %d",subs);

    mul= num1*num2;
    printf("\nMultiplication is = %d",mul);

    div=num1/num2;
    printf("\nDivsion is = %d",div);

    mod=num2%num1;
    printf("\nModulus is = %d",mod);
    return 0;
}
hasil run :


Postingan terkait:

Belum ada tanggapan untuk "Contoh operator aritmatika bahasa C (input angka sendiri)"

Post a Comment