Keď to sptavím tak ako si napísal, tak to nefunguje už vobec. V premennych su strasne velke cisla. Neviem si stym rady.

S vypisom som si tiež nevedel rady, tak som ho robil komplikovane ešte v cykle, hned po vlozeni konecnej hodnoty koeficientu do c[j] s exponentom n1+n2-j . Nieje chyba niekde tam?
Citácia:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int *a, *b, *c, n1, n2, i, j;
printf("Zadejte stupen polynomu A:\n");
if(scanf("%d", &n1)!=1) {
printf("Nespravny vstup.\n") ;
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 1;
}
if(n1<0) {
printf("Nespravny vstup.\n") ;
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 2;
}
else
{
if((a = (int*)malloc((n1+1)*sizeof(int)))== NULL) {
printf("Chyba pri alokaci pameti, program bude ukoncen");
return 7;}
printf("Zadejte koeficienty polynomu A:\n");
for (i=0; i<=n1; i++)
{
if(scanf("%d", &a[i])!=1){
printf("Nespravny vstup.\n") ;
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 5;
}
}
}
printf("Zadejte stupen polynomu B:\n");
if(scanf("%d", &n2)!=1) {
printf("Nespravny vstup.\n") ;
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 3;
}
if(n2<0) {
printf("Nespravny vstup.\n") ;
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 4;
}
else
{
if ((b = (int*)malloc((n2+1)*sizeof(int))) == NULL){
printf("Chyba pri alokaci pameti, program bude ukoncen");
return 7;}
printf("Zadejte koeficienty polynomu B:\n");
for (i=0; i<=n2; i++)
{
if(scanf("%d", &b[i])!=1) {
printf("Nespravny vstup.\n") ;
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 6;
}
}
}
if((c = (int*)malloc((n1+n2+1)*sizeof(int)))== NULL){
printf("Chyba pri alokaci pameti, program bude ukoncen");
return 7;}
for (j=0; j<(n1+n2+1); j++)
{
for (i=0; i<=j; i++)
{
if ((j-i)<=n2 && i<=n1) c[j]=a[i]*b[j-i]+c[j];
}
if (c[j]!=0)
{
if (j==0)
{
if (c[j]<-1 && (n1+n2-j)!=1 && (n1+n2-j)!=0) printf("%+dx<sup>%d</sup>", c[j], (n1+n2-j));
if (c[j]<-1 && (n1+n2-j)==1) printf("%+dx", c[j]);
if (c[j]==-1 && (n1+n2-j)==1) printf("-x");
if (c[j]==1 && (n1+n2-j)==1) printf("x");
if (c[j]>1 && (n1+n2-j)==1) printf("%dx", c[j]);
if (c[j]>1 && (n1+n2-j)!=1 && (n1+n2-j)!=0) printf("%dx<sup>%d</sup>", c[j], (n1+n2-j));
if (c[j]>1 && (n1+n2-j)==0) printf("%d", c[j]);
if (c[j]<-1 && (n1+n2-j)==0) printf("%d", c[j]);
if (c[j]==1 && (n1+n2-j)!=0 && (n1+n2-j)!=0) printf("x<sup>%d</sup>", (n1+n2-j));
if (c[j]==-1 && (n1+n2-j)!=0 && (n1+n2-j)!=0) printf("-x<sup>%d</sup>", (n1+n2-j));
} else
{
if ((c[j]<-1 || c[j]>1) && (n1+n2-j)!=1 && (n1+n2-j)!=0) printf("%+dx<sup>%d</sup>", c[j], (n1+n2-j));
if ((c[j]<-1 || c[j]>1) && (n1+n2-j)==1) printf("%+dx", c[j]);
if (c[j]==-1 && (n1+n2-j)==1) printf("-x");
if (c[j]==1 && (n1+n2-j)==1) printf("x");
if (c[j]==-1 && (n1+n2-j)==0) printf("%+d", c[j]);
if (c[j]==1 && (n1+n2-j)==0) printf("%+d", c[j]);
if ((c[j]<-1 || c[j]>1) && (n1+n2-j)==0) printf("%+d", c[j]);
if (c[j]==1 && (n1+n2-j)!=0 && (n1+n2-j)!=0) printf("+x<sup>%d</sup>", (n1+n2-j));
if (c[j]==-1 && (n1+n2-j)!=0 && (n1+n2-j)!=0) printf("-x<sup>%d</sup>", (n1+n2-j));
}
}
}
free(a);
free(b);
free(c);
printf("\n");
#ifndef __PROGTEST__
system("PAUSE");
#endif
return 0;
}