Knowee
Questions
Features
Study Tools

A C program contains the following variable declarations.f l o a t a = 2.5, b = 0.0005, c = 3000.;Show the output resulting from each of the following p r i n t f statements.(a) p r i n t f ( " % f %f%f",a, b, c ) ;(b) p r i n t f ( ' % 3 f %3f % 3 f n , a, b, c ) ;(c) p r i n t f ( " 8 f %8f % 8 f " , a, b, c ) ;(d) p r i n t f ( " % 8 . 4 f %8.4f %8.4fn, a, b, c ) ;( e ) p r i n t f ( I 1 % 8 . 3 f %8.3f %8.3f1', a, b, c ) ;cf) p r i n t f ( " % e %e %e", a, b, c ) ;(g) p r i n t f ( " % 3 e %3e %3e", a, b, c ) ;(h) p r i n t f ( " % l 2 e %12e %12e', a, b, c ) ;( i ) p r i n t f ( " % l 2 . 4 e %12.4e %12.4en, a, b, c ) ;(j) p r i n t f ( " % 8 . 2 e %8.2e %8.2e", a, b, c ) ;( k ) printf("%-8f %-8f %-8f", a, b, c ) ;(0 p r i n t f ( " % + 8 f %+8f %+€If", a, b, c ) ;(m) p r i n t f ( " % O 8 f % O a f % O a f n , a, b, c ) ;(n) p r i n t f ( " % # 8 f %#8f % # 8 f " , a, b, c ) ;(0) p r i n t f ( " % g %g %g", a, b, c ) ;(p) p r i n t f ( " % # g %#g %#g", a, b, c ) ;4.80 A C program contains the following variable declarations.char c l = ' A ' , c2 = " B ' , c3 = ' C ' ;Show the output resulting from each of the following p r i n t f statements.(a) p r i n t f ( * % c %c %c", c l , c2, c3);( 6 ) p r i n t f ( " % c % c % c " ,c l , c2, c3);(c) p r i n t f ("%3c %3c %3c" c l , c2, c3) ;(6) printf("%3c%3c%3cW,c l , c2, c3);( e ) p r i n t f ( "cl=%c c2=%c c3=%cW,c l , c2, c3) ;4.81 A C program contains the following statements.#include <stdio.h>char t e x t [ 801 ;Write a p r i n t f function that will allow the contents of t e x t to be displayed in the following ways.(a) Entirely on one line.(b) Only the first eight characters.(c) The first eight characters, preceded by five blanks.(d) The first eight characters, followed by five blanks.4.82 A C program contains the following array declaration.char t e x t [ 8 0 ] ;Suppose that the following string has been assigned to t e x t .

Question

A C program contains the following variable declarations.f l o a t a = 2.5, b = 0.0005, c = 3000.;Show the output resulting from each of the following p r i n t f statements.(a) p r i n t f ( " % f %f%f",a, b, c ) ;(b) p r i n t f ( ' % 3 f %3f % 3 f n , a, b, c ) ;(c) p r i n t f ( " 8 f %8f % 8 f " , a, b, c ) ;(d) p r i n t f ( " % 8 . 4 f %8.4f %8.4fn, a, b, c ) ;( e ) p r i n t f ( I 1 % 8 . 3 f %8.3f %8.3f1', a, b, c ) ;cf) p r i n t f ( " % e %e %e", a, b, c ) ;(g) p r i n t f ( " % 3 e %3e %3e", a, b, c ) ;(h) p r i n t f ( " % l 2 e %12e %12e', a, b, c ) ;( i ) p r i n t f ( " % l 2 . 4 e %12.4e %12.4en, a, b, c ) ;(j) p r i n t f ( " % 8 . 2 e %8.2e %8.2e", a, b, c ) ;( k ) printf("%-8f %-8f %-8f", a, b, c ) ;(0 p r i n t f ( " % + 8 f %+8f %+€If", a, b, c ) ;(m) p r i n t f ( " % O 8 f % O a f % O a f n , a, b, c ) ;(n) p r i n t f ( " % # 8 f %#8f % # 8 f " , a, b, c ) ;(0) p r i n t f ( " % g %g %g", a, b, c ) ;(p) p r i n t f ( " % # g %#g %#g", a, b, c ) ;4.80 A C program contains the following variable declarations.char c l = ' A ' , c2 = " B ' , c3 = ' C ' ;Show the output resulting from each of the following p r i n t f statements.(a) p r i n t f ( * % c %c %c", c l , c2, c3);( 6 ) p r i n t f ( " % c % c % c " ,c l , c2, c3);(c) p r i n t f ("%3c %3c %3c" c l , c2, c3) ;(6) printf("%3c%3c%3cW,c l , c2, c3);( e ) p r i n t f ( "cl=%c c2=%c c3=%cW,c l , c2, c3) ;4.81 A C program contains the following statements.#include <stdio.h>char t e x t [ 801 ;Write a p r i n t f function that will allow the contents of t e x t to be displayed in the following ways.(a) Entirely on one line.(b) Only the first eight characters.(c) The first eight characters, preceded by five blanks.(d) The first eight characters, followed by five blanks.4.82 A C program contains the following array declaration.char t e x t [ 8 0 ] ;Suppose that the following string has been assigned to t e x t .

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

(a) The output resulting from the first printf statement is: "2.500000 0.000500 3000.000000".

(b) The output resulting from the second printf statement is: " 2.500 0.001 3000.000".

(c) The output resulting from the third printf statement is: " 2.50000000 0.00050000 3000.00000000".

(d) The output resulting from the fourth printf statement is: " 2.5000 0.0005 3000.0000".

(e) The output resulting from the fifth printf statement is: " 1 2.500 0.001 3000.000".

(f) The output resulting from the sixth printf statement is: "2.500000e+00 5.000000e-04 3.000000e+03".

(g) The output resulting from the seventh printf statement is: " 2.500e+00 5.000e-04 3.000e+03".

(h) The output resulting from the eighth printf statement is: " 2.50000000e+00 5.00000000e-04 3.00000000e+03".

(i) The output resulting from the ninth printf statement is: " 2.5000e+00 5.0000e-04 3.0000e+03".

(j) The output resulting from the tenth printf statement is: " 2.50e+00 5.00e-04 3.00e+03".

(k) The output resulting from the eleventh printf statement is: "2.500000 0.000500 3000.000000".

(l) The output resulting from the twelfth printf statement is: " 2.500000 0.000500 3000.000000".

(m) The output resulting from the thirteenth printf statement is: " 2.500000 0.000500 3000.000000".

(n) The output resulting from the fourteenth printf statement is: " 2.500000 0.000500 3000.000000".

(o) The output resulting from the fifteenth printf statement is: "2.5 0.0005 3000".

(p) The output resulting from the sixteenth printf statement is: "2.5 0.0005 3000".

(a) The output resulting from the first printf statement is: "A B C".

(b) The output resulting from the second printf statement is: "A B C".

(c) The output resulting from the third printf statement is: " A B C".

(d) The output resulting from the fourth printf statement is: "ABC".

(e) The output resulting from the fifth printf statement is: "cl=A c2=B c3=C".

This problem has been solved

Similar Questions

Suppose that in a C program snippet, followings statements are used

What is the output of the following C Program?

What will be the output of the following C code?void main() {  int a[] = {1,2,3,4,5}, *p;  p = a;  ++*p;  printf("%d ", *p);p += 2;  printf("%d ", *p);}a.24b.22c.23d.34

Predict the output of the following C Programming Snippet:#include <stdio.h>int main() {  int a = 8, b = 6;  printf("%d %d", a & b, a | b);  return 0;}

What will be the output of the following C code?#include<stdio.h>int main(){ int a=0, b=1, c=2; *((a+1 == 1) ? &b : &a) = a ? b : c; printf("%d, %d, %d\n", a, b, c); return 0;} Ops:   A. 0,2,2    B. 2,2,2    C. 0,1,2    D. 1,1,2

1/4

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.