« Home | Overriding in java » | What is overloading in java » | Program to reverse a string » | XML Parser in Java » | Algorithms Used in Garbage collection » | Lower Case to Uppre Case Conversion » | PRINTING THE NON-PRIMES » | PRIME FACTORS OF ALL NON-PRIMES BELOW 500 » | What is Garbage Collection & Why is Garbage Collec... » | Public static void main (String args[]) » 

Saturday, April 08, 2006 

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);
}

About me

  • I'm phanindra
  • From Hyderabad, Andhra Pradesh, India
  • An Alumini of JNTU Hyd into happening IT industry...
My profile

Visitors
Bloggeries Blog Directory BlogRankings.com singapore blog directory blog search directory
Google
 
Web conceptoftheday.blospot.com