C Programming Examples with Output Part - 4 - Ishwaranand

News

C Programming Examples with Output Part - 4

Program

1) What is the output of the following program? - 3 Value Increment decrement

void main()
{
             int  x=125, y=140, z=175;
             char a= 'A', b='B', c='c';
 
             X= ++X + --Y + Z--;
             Y=X-- + ++Y + Z++;
             Z=--X + Y + Z++;
             A= A++;
             B+=1;
             C= --C+ 1;

            printf ("x=%d y=%d z=%d/n", x, y, z);
            printf (" a=%c b=%c c=%c/n", a, b, c);
            printf ("a=%d b=%d c=%d/n", a,b,c);
}

Output:
x=438 y=754 z=1368
a=B b=C c=C
a-66 b=67 c=67

2) what is the output of following program? - Math Formula.

# include < stdio.h>
 main()
{
            int x=3, y=5, z=7, w=9;

            w+=x;
            printf("w=%d/n", w);

            x*=z;
            printf("w= %d/n", x);

            w=x%y+y%x-z%x-x%z;
            printf('w=%d/n",w);

            w=x/z+y/z + (x+y) /z;
            printf("w=%d/n", w);

            w=x/z*y/z+x*y/z;
            printf("w=%d/n", w);
}

output:
w=12
x=21
w=-1
w=6
w=17

3) What is the output of the following program? level adjustment.

void main()
{
            int  x=420, y=777, z=1230, w=4440;

            printf("%d/n%d/n%d/n%d", x, y, z, w);
            printf("/t%d/n/t%d/n%d/n/t%d", x, y, z, w)
            printf("%d %d", x+z-y*y, (y-z%w);
}

output:
420
777
1230
4440   420
           777
1230
           4440-12255  6348

No comments

Comment on Ishwaranand or Happy Day
Not, Add any types of links