Page 14 of 14

Re: Presentation error on 160

Posted: Wed Aug 07, 2013 11:00 pm
by brianfry713
Don't print a space at the end of a line.

Re: Presentation error on 160

Posted: Sat Aug 17, 2013 2:54 pm
by techbd123
Thanks Guru! Brianfry

Re: Presentation error on 160

Posted: Wed Mar 26, 2014 10:34 pm
by vsha041
Thanks for the edge case Brian. And those getting runtime error - looks like input contains number greater than 100 as well.

Re: 160 - Factors and Factorials

Posted: Wed Mar 26, 2014 10:34 pm
by vsha041
Those getting runtime error, looks like input contains number greater than 100 so generate little extra primes.

Re: 160 - Factors and Factorials

Posted: Sun Aug 17, 2014 1:14 pm
by RedCode119
I can't find my problem will you help me :( here's my code
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
long n,i,j,k,m;
while(cin>>n, n!=0)
{
long fac[25]={0},prime[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
for(i=2; i<=n; i++)
{
k=i;
while(k>=1)
{
for(j=2; j<=k; j++)
{
if(k%j==0)
{
for(m=0;m<25;m++)
{
if(j==prime[m])
{
fac[m]++;
break;
}

}
break;
}

}
k=k/j;
}

}
int count=0;
printf("%3d! =",n);
for(i=0;fac!=0;i++)
{
if(count==15)
printf("\n%6c",' ');
printf("%3d",fac);
count++;
}
printf("\n");

}
return 0;
}

Re: 160 - Factors and Factorials

Posted: Mon Aug 18, 2014 4:13 am
by lighted
Input

Code: Select all

100
0
Acc output

Code: Select all

100! = 97 48 24 16  9  7  5  5  4  3  3  2  2  2  2
        1  1  1  1  1  1  1  1  1  1
Your output

Code: Select all

100! = 97 48 24 16  9  7  5  5  4  3  3  2  2  2  2
        1  1  1  1  1  1  1  1  1  110012451124297438  1879047287917443473460340792421473239042147323904124515242638601245168
Don't forget to remove your code after getting accepted. 8)

Re: 160 - Factors and Factorials

Posted: Thu Jan 08, 2015 4:08 pm
by uradura

Re: 160 - Factors and Factorials

Posted: Fri Jan 09, 2015 12:16 am
by brianfry713
It looks like you figured it out.

160 - Factors and Factorials why PE

Posted: Thu Jan 22, 2015 2:34 pm
by NAbdulla
Help Help.....
This code gives PresentationE

Re: 160 - Factors and Factorials

Posted: Fri Jan 23, 2015 1:32 am
by brianfry713
Next time post in the existing thread.
Look at the spacing in the sample output.

Re: 160 - Factors and Factorials

Posted: Thu Jul 16, 2015 7:46 pm
by Tarol Hasan
http://ideone.com/N6jRqA
what's wrong???