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 / vignesh1988i
this code depends upon the value of 'n' actually....... if
the value is 4 the operation is differewnt... if 3 its
different..... so give the value of 'n'!
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What are directives in c?
What is use of integral promotions in c?
What is data types?
What does c mean?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
Differentiate between #include<...> and #include '...'
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is a c token and types of c tokens?
Can we use visual studio for c?
What is realloc in c?
What are the valid places to have keyword “break”?
What is the difference between int main and void main?
Explain why can’t constant values be used to define an array’s initial size?
What is the difference between call by value and call by reference in c?
Explain the properties of union. What is the size of a union variable