> Online tutorial : REVERSE NUMBER PROGRAMMING USING C
Showing posts with label REVERSE NUMBER PROGRAMMING USING C. Show all posts
Showing posts with label REVERSE NUMBER PROGRAMMING USING C. Show all posts

armstrong number in c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

void main()
{
        long num1,num2=0,mcount=0, nums;
        char str1[35], strc;

        clrscr();
        printf("Enter a number : ");
        scanf("%ld",&num1);

         ltoa(num1,str1,10);
         while (mcount <= (strlen(str1)-1))
         {
          strc = str1[mcount];
          nums = atoi(&strc);
          num2 = num2+pow(nums,3);
          mcount = mcount+1;
         }

         if (num1 == num2)
         {
          printf("Amstrong Number : %ld",num2);
         }
         else
         {
          printf("Not a Amstrong Number.");
         }
   getch();
}
 

REVERSE NUMBER PROGRAMMING USING C

**REVERSE NUMBER PROGRAME**
===========================

#include<studio.h>
#include<conio.h>
void main()
{
int a,b,c,s=0;
clrscr();
printf("\n a= ");
scanf("%d",&a);
while(a>0)
{
a-c=a%10;
printf("%d",c);
s=(s*10)+c;
a=a/10;
}
getch();
}