aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java
  • What would be the output of the following C program? int ...
Multiple choice

What would be the output of the following C program? int n=2, m=3, k; k = (float)m/(float)n; printf(k=%0.5d,k);

  1. k=1.00000

  2. k=0.00000

  3. k=00000.1

  4. k=00001

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This is the correct option as value 5 after the decimal point in the printf statement allows the C compiler to prefix 0 five times before displaying the value of k.

Keep practicing — related questions

  • What will be the output of following program code? #include<stdio.h> main() { int k; float j; j=9.0/2; k=9/...
  • What will be the output of the following C code? void main() { double t=9.0,c=78.50; float Res; Res = (t+c)...
  • What will be the output of the following function? # include <stdio.h> void main() { int k,num=30; k = (num...
  • What will be the output of the following program: void main() { float val=2.; printf("%.2",val); }
  • output?? int main() { printf("%0.4f",3.414164); return 0; }
  • What will be the output of the following program : void main() { int i, n =10; for (i=1; i
  • What would be the output of the following? main() { int val1=1234; int val2=01234; printf(%d %d,val1,val2); }
  • What will be the output of the following program : void main() { printf("%f",123.); }
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Output Evaluation (1721 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy