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
What are the storage classes in C?
What does c mean in basketball?
What is the purpose of main( ) in c language?
can we have joblib in a proc ?
What is the process to create increment and decrement stamen in c?
What do mean by network ?
How do I copy files?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
What are the usage of pointer in c?
What are pointers really good for, anyway?
What are the types of functions in c?
Difference between Shallow copy and Deep copy?
What is an array in c?
c language interview questions & answer
What is nested structure?