#include <stdio.h>
int cmp (int a,int b)
{
return ((int)a-(int)b);
}
int main()
{
int t,s,i,j,a;
scanf ("%d",&t);
while (t--)
{
scanf ("%d",&s);a=0;
for (i=1;i <=s;i++)
{ int k [i];
for (j=0;j<i;j++)
{
scanf ("%d",&k [j]);
}
qsort (k,i,sizeof (int),cmp);
if (i=1)
{
a+=0;
}
else
{
a=a+k [i-1];}
}
printf ("%d\n",a);
}
}
Im trying to solve Triangle of Numbers.Please tell me whats wrong with my code .Im not getting any output.