+ 1
How can I print this series 1 -6 120 -5040 when user input n=7.
Read the value of an N and print the series , 1 -3 5 -7...N int n, x=1; For(int I=1;I<=n;I +=2) { Printf("%d",I*x); x*=(-1); } But I'm not know how can I print this series For N=7 output is the following series , 1 -6 120 -5040 It's like Factorial Number.
6 Antworten
+ 2
Here's a factorial list from 1 ~ 7
# 1 2 3 4 5 6 7
F 1 2 6 24 120 720 5040
Notice that you need to skip printing factorial of even numbers, and invert negative sign on each printed factorial number.
+ 9
Ayesha where is your attempt?
+ 3
Is that 1 followed by -6 (negative six) then 120 followed by -5040 (negative 5040)
Or one to six, then 120 to 5040
Do they print on one line or separate line?
Please elaborate more by editing the post with additional details in post Description.
+ 3
Hadn't you tried yet 🤔
+ 2
Show your attempt
+ 2
looks like you just need to take the factorial of each result from the first series, while still keeping the sign step until last, no? Should be a fairly straightforward nested loop situation once you've gotten this far, so what's the problem you're having?