WHAT WILL BE OUTPUT OF BELOW CODE . . AND PLEASE EXPLAIN HOW
IT COME ..
#include<stdio.h>
#include<conio.h>
void main()
{
int k=20;
printf("%d%d%d%d",k,k++,++k,k);
getch();
}
Answer Posted / mohamed ali
THE ANSWER IS
20 20 22 22
YOU HAVE THE 1ST 20 AS IT'S THE INITIAL VALUE
THEN YOU HAVE K++ .... HERE WE HAVE THE SAME VALUE OF K THEN
IT WILL BE INCREMENTED BY ONE .... SO YOU HAVE THE 2ND 20
AND THEN K WILL BE 21
THE THIRD YOU HAVE ++K .... WHICH MEANS THAT YOU WILL
INCREMENT THEN TYPE THE VALUE AND SINCE YOU HAVE NOW K=21
FROM PREVIOUS STEP (K++) SO THIS VALUE WILL BE INCREMENTED
BY ONE (K = 22 ) SO YOU HAVE THE THIRD VALUE 22
THEN YOU HAVE A SINGLE K WITH NO OPERATIONS SO ANOTHER 22
IF SOMEONE SEES THAT I'M WRONG PLZ CORRECT MY VIEW
THANKS
Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
write an algorithm to display a square matrix.
What type is sizeof?
What is external variable in c?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
What is queue in c?
Which of these functions is safer to use : fgets(), gets()? Why?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Is there any data type in c with variable size?
Explain the term printf() and scanf() used in c language?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
What is string in c language?
Explain how many levels deep can include files be nested?
can any one tel me wt is the question pattern for NIC exam
What are the 4 types of organizational structures?
How do you sort filenames in a directory?