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
Hai what is the different types of versions and their differences
What are global variables and explain how do you declare them?
What is a structural principle?
Can the curly brackets { } be used to enclose a single line of code?
Describe dynamic data structure in c programming language?
Combinations of fibanocci prime series
Describe the steps to insert data into a singly linked list.
Why does notstrcat(string, "!");Work?
what are # pragma staments?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
What is data type long in c?
How can variables be characterized?
What is 2 d array in c?
Explain how can you restore a redirected standard stream?
Tell me the use of bit field in c language?