Jumat, 02 September 2016

Operator Unary Pada C


#include<stdio.h>
#include<conio.h>

main()
{
int x;
float y;

x = +5;
y = -2.12;

printf("\n Nilai x : %i",x);
printf("\n Nilai y : %0.2f\n",y);

x=-x; //Merubah Nilai Menjadi Negatif
y=-y;

printf("\n Nilai x : %i",x);
printf("\n Nilai y : %0.2f\n",y);

//Operasi increment, x = x + 1;
x++;
//Operasi decrement, y = y - 1;
y--;

printf("\n Nilai x : %i y : %.2f\n",x,y);

getch();
}


Output :



0 komentar:

Posting Komentar