Pages

Showing posts with label ARMSTRONG NUMBERS IN BETWEEN MIN AND MAX VALUES. Show all posts
Showing posts with label ARMSTRONG NUMBERS IN BETWEEN MIN AND MAX VALUES. Show all posts

Saturday, 2 February 2019

ARMSTRONG NUMBERS IN BETWEEN MIN AND MAX VALUES

// prg to illustrate Armstrong numbers in between min and max values

#include<stdio.h>

void main()

{

 int min,max,n,r,arm=0,temp;

 printf("\n Enter min value :");

 scanf("%d",&min);

 printf("\n Enter max value :");

 scanf("%d",&max);

 printf("\n Armstrong number in the given range :");

 for(n=min ; n<=max ; n++)
 
  {
 
   temp=n,arm=0;

   while(temp != 0)

     {

      r = temp % 10;

      temp = temp / 10;

      arm = arm + (r * r * r);

     }

     if( n == arm )

       printf("\n%d  is an armstrong  \n",n);

  }

}  

output:


Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...