|
|
вернуться в форумWho can help,Why I am always wrong Послано kkk 12 апр 2002 10:40 #include<stdio.h> void A(int i) { int n; for(n=1;n<i;n++) printf("sin(%d+",n); printf("sin(%d",i); for(n=1;n<=i;n++) printf(")"); } void S(int i) { int n; for(n=1;n<i;n++) printf("("); for(n=1;n<i;n++) { A(n); printf("+%d)",i-n+1); } A(i); printf("+1"); } main() { int n; scanf("%d",&n); S(n); } You have made a very little mistake.... >Hei, it is OK your pogram, just have a look at the sample output - you have to change the sign "+" and "-" - your program outputs just sign "+" - you have to change the sign each time - that is it. I think, you will get accepted - TRY IT!!!!! Re: You have made a very little mistake.... Послано kkk 13 апр 2002 14:19 Thank you for your information.But I still misunderstand your meaning Please explain more details Thanks Again!!! Hei, have a look at the semple output... As I saw our program, you for n=3 your putput is: ((sin(1)+3)sin(1+sin(2))+2)sin(1+sin(2+sin(3)))+1 But have a look at the sample putput - it is: ((sin(1)+3)sin(1-sin(2))+2)sin(1-sin(2+sin(3)))+1 The signs "+" and "-" !!! Your program outputs just "+"!!!!!! TEst your program and the sample outout - you'l see! If you haven't anderstood me,write me again... Bye! Re: Who can help,Why I am always wrong > I am always wrong Sounds like a logical fallacy, lol :D "i'm lying" Re: Who can help,Why I am always wrong Just change 5th line from printf("sin(%d+",n); to printf("sin(%d%c", n, n & 1 ? '-' : '+'); |
|
|