Input/Output Penjumlahan Dua Variabel



Fungsi input:
scanf("..",..);

Example:
scanf("%d", &x);


Fungsi output:
printf("..",..);

Example:
printf("%d", x);


Kedua fungsi tersebut terdapat di library:
#include <stdio.h>


Contoh source code:
#include <stdio.h>

int main()
{
   int x;
   int y;

   printf("Masukkan nilai x: ");
   scanf("%d", &x);
   printf("Masukkan nilai y: ");
   scanf("%d", &y);

   printf("x + y = %d", x + y);

   return 0;
}

Jenis placeholder:
%d, %i         int
%f             float
%c             char
%s             string(char* or char[])
%li            long int
.
.
etc.

1 comments:

mantap bang thanks...

Reply

Post a Comment