Find the output of C Program ?
main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
} ?
While calculating the x value, x & y values are post incremented. So, the values of x & y are added and then incremented i.e. x=56, y=36
While calculating the y value, x & y values are preincremented, so x & y values are incremented and then added i.e x=57, y=37.
{ x=y++ + x++; } equal to
x=y+x;//35+20
x++; //56
y++; //36
}
y=++y + ++x; is equal to
++y;//37
++x;//57
y=y+x;//37+57
}
Output:
x=57
y=94
Related Tags
- A Simple C Program for Mathematical Calculation,
- Accentur interview questions and answers,
- Applied Materials interview questions and answers,
- Asian Paints Ltd. interview questions and answers,
- Basics of Common Math Functions in C Programming,
- Bosch India Software interview questions and answers,
- C Programming Examples on Mathematical Functions,
- c programming math functions,
- c programming math operators,
- C/C++ Mathematical Programs,
- c++ math code examples,
- c++ programs mathematical formula,
- Capgemini interview questions and answers,
- CASTING NETWORKS INDIA PVT LIMITED interview questions and answers,
- CGI Group Inc interview questions and answers,
- Chetu interview questions and answers,
- Ciena Corporation interview questions and answers,
- Collabera Technologies interview questions and answers,
- computer programming formulas,
- define main() in c language,
- Dell International Services India Pvt Ltd interview questions and answers,
- DHFL Pramerica Life Insurance Company Ltd interview questions and answers,
- Elico HealthCare Services Ltd interview questions and answers,
- explain the importance of main function in c,
- Flipkart interview questions and answers,
- for loop in c programming example,
- HCL Technol interview questions and answers,
- IBM interview questions and answers,
- importance of main function in c++,
- Indecomm Global Services interview questions and answers,
- main function c programming,
- main function in c is user defined or not,
- main in c programming,
- main method in c,
- main() function definition,
- math functions in c programming examples,
- mathematical programming in c,
- Mathematical Programs in C Langauge,
- mathematical programs in c language,
- mathematics in c programming,
- Mavenir interview questions and answers,
- Mphasis interview questions and answers,
- NetApp interview questions and answers,
- Oracle Corporation interview questions and answers,
- PeopleStrong interview questions and answers,
- R Systems interview questions and answers,
- Raqmiyat Information Technologies Pvt Ltd interview questions and answers,
- Reliance Industries Ltd interview questions and answers,
- SAP Labs India Pvt Ltd interview questions and answers,
- syntax of function in c,
- Tata AIA Life Insurance interview questions and answers,
- Tech Mahindr interview questions and answers,
- The Linde Group interview questions and answers,
- what does main() mean in c,
- what is main function in c++,
- what is main() function,
- what is main() in c++,
- what is the main function,
- what is the purpose of main function in c language,
- zencer interview questions and answers