C programmers wanted: I´m late with homework for school, really need it...

c programmers wanted: I´m late with homework for school, really need it, it´s literally just a few simple assignments for school, basic stuff, more info:
>the deadline is today midnight
>assignment is like: "make a programm for calculating factorial of a number..."
>am willing to pay for it
>any suggestions who to ask appreciated
>ask anything if not clear

Other urls found in this thread:

paste.fedoraproject.org/516390/
twitter.com/NSFWRedditVideo

int main(int argc, char **argv)
{
if (argc < 1) return -1;

int num = atoi(argv[1]);

if (num < 1) return -2;

int factorial = 0;

for (int i = 1; i

Oh, and apparently factorial is multiplication, so change the addition to mul.

Holy shit, OP. Calculating factorial is the easiest shit. Are you kidding me?
You know what, here.
I'll do it, just so you get past this class, get into something hard, and have no fucking clue what you are doing.

I'm on mobile, so formatting is going to suck.

int fact(int x) {
if (x0;i--)ret*=i;
return ret;
}

Depending on the c standard, you can't declare your loop index in the loop conditional.
Also, you initialize factorial to 0, so of you change the addition to multiplication it will always be zero. Initialize to 1.

Fails for 0!.

Kek

man, that´s just an example, i took the simplest one that was there, in real i need much more complicated stuff, if there are people who are gonna help me with it, I´ll start translating them

yes this is it

just post it dude fuck

OP again here, if there´s anyone to add me on skype or anywhere else that can help me with it, I´m ready to for example gift you something on steam

just post it dude fuck

k, sure, need a minute for it, should´ve done it at the beginning

My C is a bit rusty, but I'm doing C++ currently. The calculation should be basically this, assuming n is not negative:
double fact=1;
for(int i=1;i

K, HERE WE GO

Write a function int even(int [], int pocetx, int y []), which copies all even numbers from field x to field y in the order they are in the field x and returns the number of array elements in y. Pocetx specifies the number of array elements x.
You can assume that the argument y, will be of sufficient size for all even elements.

Mobile shitty formatting deal with it.

int even(int x[], int pocetx, int y[]) {
int i;
int s = 0;
for(i=0;i

help much appreciated user, some mistakes but i guess i can handle them, another one i need is:

Write a function int strInsert (char * dst, int len, const char * src, int offset), which inserts a copy of the string src to string dst from position offset. Argument specifies only the number of characters reserved for field dst (including the termination code \ 0). If it is not possible to insert the restricted area chain, function does nothing and returns 1. Otherwise (if it is possible to insert the restricted area string) returns 0. For example. for DST: thisisthestring, offset 6, Src second call strInsert (dst, 50, src, 6) returns 0, and the DST will be thisisthesecondchain.

paste.fedoraproject.org/516390/
Here, this'll deal with pretty big factorials too, I just threw 77! at it and it got 1.451831e+113 correctly

>for(int i=1;ifact*=i;
for(int i; ++i

freakin hell, stop discussing about that, i dont even need that one

Why do you need more complicated? Elegance is important too.

Create a table based function, it's faster at run time which is The single most important part of a calculation.

Allow for your function to be used by reals and integers. Return positive infinity instead of an error for numbers that overflow for reals, but an error for errors that overflow byte, short, word, double integers.

Returning positive infinity for real overflows of n! allows the error to be generated by subsequent calculations. (1*infinity)/(2*negative infinit) should yield -1/2.

The Hackers Bible might be useful to you. It's not about security issues, it's about computer science, math, etcetera.

>more compilcated assignments
I have many assignments, the one I wrote up there was just an example

i guess i´ll make another thread where I´ll be explaining shit clearly

int fact(int n)
{
return n

int fact(int n){return (n == 0)?1:abs(n) * fact(abs(n) - 1);}

just... ahhhh...

#include
#include
void.main(){
clrscr();
int n,i,f;
f=1;
Coutn;
if(n!=0){
for(i=1;i

Also my skype is silvahawk99 you can add me to ask for more.

?

¡¿?!

You forgot to check that strtold doesn't fail.

are you retarded?

unsigned int factorial(unsigned int x)
{
for (int i = x - 1; i > 0; i--)
{
x *= i;
}
return x;
}

Cleanest way to get the factorial. Prove me wrong bitches.

try 0

what's your point here

OP is deeply and truly fucked if they can't do this shit

correctness, negatives

yes

output won't be negative so what's the point, its pretty much the same

int is signed so it is possible to give negative input

i have never ever needed this function in real life, isn't it great been taught it?

What school asks for homework for new years?

asian one

Happy new years eve from me...go fuck your ex gf tonight or even your sister with this tool i found....use it before it gets patched lol and have a banging 2017 - snap-leak-cf

making a new one