

InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
1. |
We want to round off , a , to an value, The correct way to do is |
Answer» Rounding off a value means replacing it by a nearest value that is approximately equal or smaller or greater to the given number. y = (int)(x + 0.5); here x is any float value. To roundoff, we have to typecast the value of x by using (int) Example: #include <stdio.h>int main (){ float x = 3.6; int y = (int)(x + 0.5); printf ("Result = %d\n", y ); return 0;} Output:Result = 4. | |
2. |
What are the different types of real data type in C ? |
Answer» The floating point data types are called real data types. Hence float, double, and long double are real data types. | |
3. |
What will you do to treat the constant 3.14 as a ? |
Answer» Given 3.14 is a double constant. To specify 3.14 as long double, we have to add L to the 3.14. (i.e 3.14L) | |