C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - Point Out Correct Statements (Q.No. 2)
2.
Which of the following operations are INCORRECT?
Answer: Option
Explanation:
float a = 3.14; a = a%3; gives "Illegal use of floating point" error.
The modulus (%) operator can only be used on integer types. We have to use fmod() function in math.h for float values.
Discussion:
17 comments Page 2 of 2.
Akram regard said:
1 decade ago
It is very simple in C language we can not Apply % operator on float type value.
Siddharth Jagani said:
1 decade ago
What if we don't put L in k= 365L?
Rahul said:
1 decade ago
In option A there is chance to an over flow condition.
Sharath said:
1 decade ago
% is a modulus operator. it gives the remainder after dividing.
Harry said:
1 decade ago
What is the work of %?
Garry said:
1 decade ago
L stands for long data type,
Poonam said:
1 decade ago
What about long int k=365L.
What is this L stands for?
What is this L stands for?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers