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 / vikraman85

Here a is declared as static,so it can't be re-initialized..

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the storage classes in C?

626


What does c mean in basketball?

563


What is the purpose of main( ) in c language?

624


can we have joblib in a proc ?

1657


What is the process to create increment and decrement stamen in c?

589






What do mean by network ?

660


How do I copy files?

624


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

589


What are the usage of pointer in c?

704


What are pointers really good for, anyway?

618


What are the types of functions in c?

576


Difference between Shallow copy and Deep copy?

1573


What is an array in c?

598


c language interview questions & answer

1464


What is nested structure?

576