#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i=5,j=5,k=5;
i= i++ * ++i;
Output:
37
49
27
#include<conio.h>
void main()
{
clrscr();
int i=5,j=5,k=5;
i= i++ * ++i;
j= ++j * ++j;
k= k++ * k++;
printf("%d\n",i);
printf("%d\n",j);
printf("%d\n",k);
getch();
}
k= k++ * k++;
printf("%d\n",i);
printf("%d\n",j);
printf("%d\n",k);
getch();
}
37
49
27
Explanation:
i=i++ * ++i;
it reads from right to left
so first i increments so i=++i * 6;
Now i value is 6 so multiply 6 * 6=36
then perform post increment in i so Value becomes 37
so first i increments so i=++i * 6;
Now i value is 6 so multiply 6 * 6=36
then perform post increment in i so Value becomes 37
j & K output is also same as above explanation.
No comments:
Post a Comment