#include<stdio.h>
main()
{
printf("===============================================\n");
printf("=PROGRAM KALKULATOR INCREMENT DECREMENT ALFIAN=\n");
printf("===============================================\n");
int x,y;
printf("input number 1=");
scanf("%i",&x);
printf("===PRE===\n");
printf("result INCREMENT= %i\n",++x);//a
printf("result DECREMENT = %i\n",--x);//b
printf("===POST===\n");
printf("resultINCREMENTn= %i\n",x++);//nilaib tetap, nilai sebenarnya di save memory,
printf("resultDECREMENTn= %i\n",x--);//nilai memory tetap, nilai sebenarnya save momory
}
/*
#include <stdio.h>
int main()
{
int x, y;
x=5;
printf("x = %d\n", x);//gives defined value of x
printf("x = %d\n", x++);//gives x =5 but only for display, actual value stored in memory is 6.
printf("x = %d\n", x);//gives x = 6 for display but actual value stored in memory is 5
printf("x = %d\n", --x);//gives x = 4 due to prefix properties
printf("x = %d\n", ++x);//gives x =5 due to the same
}
*/
Tidak ada komentar:
Posting Komentar