C Language Progarm To Generate ARMSTRONG,RAMANUJAM and STRONG Numbers


#include
<stdio.h>
#include
<math.h>
main()
{
int j,a,b,c,d,i,res,ch;
printf("1.ARMSTRONG NOS  \n 2.RAMANUJAM NOS \n3.STRONG NOS");
printf("\nENTER CHOICE:");
scanf("%d",&ch);
switch(ch)
{
case 1:
for(i=100;i<=999;i++)
{
a=i%10; b=i/10; c=b%10; d=b/10;
res=pow(a,3)+pow(c,3)+pow(d,3);
if (res==i) printf("\n%d",i);
}
break;
case 2:           printf("\nrama");
for(i=1000;i<=9999;i++)
{
c=(i%100)+(i/100);
if(i==(c*c)) printf("\n%d",i);
}
break;
case 3:
for(i=100;i<=999;i++)
{ a=i; res=0;
while(a!=0) { c=1;
b=a%10;
for(j=1;j<=b;j++)
c=c*j;
res=res+c;
a=a/10;
}
if(res==i) printf("\n%d",i);
}
break;
}
getch();
}

OUTPUT:

1.ARMSTRONG NOS
2.RAMANUJAM NOS
3.STRONG NOS
ENTER CHOICE:1
153
370
371
407
1.ARMSTRONG NOS
2.RAMANUJAM NOS
3.STRONG NOS
ENTER CHOICE:2
rama
2025
3025
9801


Contact:
Mr. Roshan P. Helonde
Mobile: +91-7276355704
WhatsApp: +91-7276355704
Email: roshanphelonde@rediffmail.com
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *