C Programming - Input / Output - Discussion
|
|
|
|
Read more:"I never think of the future. It comes soon enough."
- Albert Einstein
|
| 5. |
To print out a and b given below, which of the following printf() statement will you use?
#include<stdio.h>
float a=3.14;
double b=3.14;
|
| [A]. |
printf("%f %lf", a, b); | | [B]. |
printf("%Lf %f", a, b); | | [C]. |
printf("%Lf %Lf", a, b); | | [D]. |
printf("%f %Lf", a, b); |
Answer: Option C
Explanation:
To print a float value, %f is used as format specifier.
To print a double value, %lf is used as format specifier.
Therefore, the answer is printf("%f %lf", a, b);
|
|
Yuvraj said:
(Thu, Jul 22, 2010 02:02:39 PM)
|
|
| |
Please tell me the program code for the output as given below.
*
* *
* * *
* * * * |
|
Sankar said:
(Fri, Oct 22, 2010 06:59:30 AM)
|
|
| |
Hi Yuvraj, try this code
int ix, iy;
for(ix = 1; ix <= 4; ix++)
{
for(iy = 0; iy < ix; iy++)
{
printf("*");
}
printf("\n");
} |
|
|