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


Please Help Members By Posting Answers For Below Questions

What is null character in c?

692


What are high level languages like C and FORTRAN also known as?

687


How is a macro different from a function?

657


What is structure in c definition?

576


What is static function in c?

636






What are the standard predefined macros?

634


What is difference between array and pointer in c?

541


Explain what is the advantage of a random access file?

667


Describe the steps to insert data into a singly linked list.

623


Explain can you assign a different address to an array tag?

648


Explain 'bit masking'?

656


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2272


What is call by value in c?

559


What is a method in c?

629


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

662