Output of the program:
#include <stdio.h>
void main(void) {
int x, y, z1, z2, z3, z4;
x = 17;
y = 5;
z1 = x / y;
printf("\nz1=%d", z1); // z1 = 17 / 5 = 3
z2 = x % y;
printf("\nz2=%d", z2); // z2 = 17 % 5 = 2
z3 = ++x;
printf("\nz3=%d", z3); // z3 = ++x = 18
z4 = y++;
printf("\nz4=%d", z4); // z4 = y++ = 5 (post-increment)
}
Output:
ini
z1=3
z2=2
z3=18
z4=5
Related Questions:
- Why is a format specifier used? Explain with examples.
- Why is an escape sequence used? Explain with examples.
- What is the purpose of the printf() function? Explain with an example.
- Differentiate between printf() and scanf() functions.
- Evaluate the following expressions:
- Write three differences between assembly language and HLLs.
- Write four characteristics of HLLs.
- Define Integrated Development Environment (IDE).
- Differentiate between constant and variable.
- Which of the following are valid C variables? Give the reason if not a valid variable.
- What are reserved words? Why should they not be used as variable names?
- Why are comments used in programs?
- What is the purpose of header files in C language?
- Describe the following High-Level Languages:
- What is C language IDE? Explain its modules in detail.
- What are the rules for specifying a variable name in C language?
- What is a preprocessor directive? Explain #include preprocessor directive in detail.
- What is a pointer in C?
- Explain the difference between a while loop and a do-while loop.
- What are the different types of storage classes in C?