Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can anyone tell me to execute the code of y = ++ x when x = 3, please tell me all how to write it if you can

+1 vote
asked Dec 13, 2019 by anonymous

5 Answers

0 votes
answered Dec 16, 2019 by Zayn (140 points)
while(x==3)

y=++x;

According to your question this is the solution. Otherwise kindly explain your question further more
0 votes
answered Dec 17, 2019 by vetri
#include<stdio.h>

int main()
{
    int a, b;
    a = 5;
  b = ++a;
  
    printf ("data after pre-increment is  %d ",b);
}
0 votes
answered Dec 17, 2019 by Erik
I'm guessing you are looking for this

if(x==3)
{
     y = ++x;
}
0 votes
answered Dec 17, 2019 by Prakash Rockez (260 points)
#include <stdio.h>

int main()
{
   int x,y;
   x=3;
   y=++x;
   return 0;
}

output:
0 votes
answered Dec 17, 2019 by Prakash Rockez (260 points)
#include <stdio.h>
#include <stdlib.h>

int main()
{
   int x,y;
   x=3;
   y=++x;
   return 0;
}

output:
commented Dec 18, 2019 by coinhawk crypto (100 points)
#include <stdio.h>
#include <stdlib.h>

int main()
{
   int x, y;
   x = 3;
   printf("this is x %d ", x);
   y = ++x;
   printf("this is y %d ", y);
   printf("this is y %d ++x %d ", y, x);
   
   // keep in mind ++ can be before or after, the variable
 // it will determine when the calculations take place
   return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...