what does the following code do?
fn(int n,int p,int r)
{
static int a=p;
switch(n){
case 4:a+=a*r;
case 3:a+=a*r;
case 2:a+=a*r;
case 1:a+=a*r;
}
}
a.computes simple interest for one year
b.computes amount on compound interest for 1 to 4 years
c.computes simple interest for four year
d.computes compound interst for 1 year
Answer Posted / mani thangaraj
I feel it as d.computes compound interest for one
year.because of switch statement any one of the four gets
executed .. and it seems to be C.I
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
How can I find out the size of a file, prior to reading it in?
Write programs for String Reversal & Palindrome check
What are the 4 types of unions?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
What is the difference between a function and a method in c?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
How will you find a duplicate number in a array without negating the nos ?
Tell us two differences between new () and malloc ()?
Write a program to know whether the input number is an armstrong number.
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
What are the advantages of using linked list for tree construction?
What is the use of function overloading in C?
Write a program to print "hello world" without using a semicolon?
what are bit fields? What is the use of bit fields in a structure declaration?