Answer Posted / jyothikrishna
Ex:1
#define A 10+10
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}
Ans : 120
Explanation:
When you compile this program. A*A will be converted into 10+10*10+10. Here it follows BODMAS rule first it will perform multiplication and next it will perform addition.
First 10+10*10+10 = 10 + 100 + 10
next 10 + 100 + 10 = 120 (Answer)
Ex:2
#define A (10+10)
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}
Ans : 400
Explanation:
When you compile this program. A*A will be converted into (10+10)*(10+10). Here it follows BODMAS rule first it will perform Bracket values and next it will perform multiplication.
First (10+10)*(10+10) = 20 * 20
next 20 * 20 = 400 (Answer)
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Does c have enums?
What are the string functions? List some string functions available in c.
What is void main () in c?
c language interview questions & answer
What is the benefit of using const for declaring constants?
Explain what is the difference between a free-standing and a hosted environment?
Place the #include statement must be written in the program?
What is identifier in c?
Write programs for String Reversal & Palindrome check
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
What is the correct code to have following output in c using nested for loop?
Is struct oop?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
Write a Program to find whether the given number or string is palindrome.