Program for print Ramanjan Numbers
/*Taking input as command line arguments and checks whether the numbers
form Ramanjan number.*/
/*Author:SivaPhanindra.Vemuri*/
#include
main(int argc,char *argv[])
{
int l,m,n,p;
if(argc!=5)
{
printf("Wrong Number of arguments\n");
exit(0);
}
l=atoi(argv[1]); //loading the values of l,m,n,p from the
// comman line arguments
m=atoi(argv[2]);
n=atoi(argv[3]);
p=atoi(argv[4]);
printf("%d\n%d\n%d\n%d\n",l,m,n,p);
if(l!=m!=p!=n)
{
if(cube(l)+cube(m)==cube(n)+cube(p))
printf("GIVEN NUMBERS FORM RAMANJAN SERIES\n");
else
printf("NUMBERS DOES'NT FORM RAMANJAN NUMBER\n");
}
else
printf("NUMBERS DOES'NT FORM RAMANJAN NUMBER\n");
}
int cube(int x) //defining cube
{
return(x*x*x);
}
form Ramanjan number.*/
/*Author:SivaPhanindra.Vemuri*/
#include
main(int argc,char *argv[])
{
int l,m,n,p;
if(argc!=5)
{
printf("Wrong Number of arguments\n");
exit(0);
}
l=atoi(argv[1]); //loading the values of l,m,n,p from the
// comman line arguments
m=atoi(argv[2]);
n=atoi(argv[3]);
p=atoi(argv[4]);
printf("%d\n%d\n%d\n%d\n",l,m,n,p);
if(l!=m!=p!=n)
{
if(cube(l)+cube(m)==cube(n)+cube(p))
printf("GIVEN NUMBERS FORM RAMANJAN SERIES\n");
else
printf("NUMBERS DOES'NT FORM RAMANJAN NUMBER\n");
}
else
printf("NUMBERS DOES'NT FORM RAMANJAN NUMBER\n");
}
int cube(int x) //defining cube
{
return(x*x*x);
}