What will be the output of following program?main( ){int k, num = 30 ;k = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) ;printf ( "\n%d", num ) ;}
Question
Solution 1
The output of the program will be 30.
Here's the step by step explanation:
- The program starts with the main function.
- Inside the main function, two integer variables 'k' and 'num' are declared. 'num' is initialized with the value 30.
- The next line is a ternary operator which is a shortha Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI
Similar Questions
What is the output of the program?void main(){ static int i=5; if(--i){ main () printf ("%d",i);}}A4,3,2,1,0BCompilation ErrorC5,4,3,2,1D0,0,0,0
What will the following code output?#include <stdio.h>int main() { int arr[3] = {1, 2, 3}; int *p = arr; printf("%d\n", *(p + 2)); return 0;}
What will be the output of the following program? #include<stdio.h> int main() { int i=10; if (i > 10) else printf ( "Hello Cocaine!" ); return 0; }
What is the output of the following code?#include <stdio.h>int main() { int arr[5] = {1, 2, 3, 4, 5}; printf("%d\n", arr[3]); return 0;}
What will be the output of the following C code?#include <stdio.h>int main() { int i; for (i = 0; i < 5; i++); printf("%d\n", i); return 0;}
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.