Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / vikraman85

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

Is This Answer Correct ?    4 Yes 1 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / subbu

gives an error because at the time of initialization we
should not use variables, we can use only constants at the
time of initialization.

Is This Answer Correct ?    4 Yes 3 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

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

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / deepali

b

Is This Answer Correct ?    2 Yes 1 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / eswaran

initializer is a constant value..so its not possible to
change the value at run time..

Is This Answer Correct ?    1 Yes 0 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

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

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / nila

d.computes compound interest for 1 year

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

0 Answers  


#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

0 Answers  


What is the total generic pointer type?

0 Answers  


How can I automatically locate a programs configuration files in the same directory as the executable?

0 Answers  


What is new line escape sequence?

0 Answers  


What are the advantages of c language?

0 Answers  


what is the use of c program?

4 Answers   Synergy, Web Synergies,


write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34

0 Answers  


Are the outer parentheses in return statements really optional?

0 Answers  


a number is perfect if it is equal to the sum of its proper divisor.. 6 is perfect number coz its proper divisors are 1,2 and three.. and 1+2+3=6... a number is deficient if the sum of its proper divisor is less than the number.. sample: 8 is deficient, coz its proper divisors are 1,2 and 4, and 1+2+4=7. abundant number, if the sum of its proper divisor is greater than the number.. sample..12 is abundant coz 1+2+3+4+6=16 which is geater than 12. now write a program that prompts the user for a number, then determines whether the number is perfect,deficient and abundant..

1 Answers  


Is the C language is the portable language...If yes...Then Why...and if not then what is problem so it is not a Portable language..???

2 Answers   TCS,


I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.

1 Answers  


Categories