Can anyone tell me the Coding for:
[ATTACH]18596[/ATTACH]
Help me!!!
I'd be happy to give you complete code so you don't have to do any work at all!
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define f(x) ((x)>0?((x)*((x)+1)/2):0)
#define g(x) (((int)sqrt(8.0*(x)+1)-1)/2)
int main(int c, char **v)
{
if (c>1)
for (c=0;c<f(atoi(v[1]));c++)printf("%s%*s%d",c==f(g(c))?"\n":" ",c==f(g(c))?atoi(v[1])-g(c)-1:0,"",g(c)+1);
return !putchar('\n');
}
There's no need to thank me, I'm here to help. :)