-->

program to display following numeric pattern.

//program to display following numeric pattern.
//      12345
//      1234
//      123
//      12
//      1
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=5;i>=1;i--)
  {
     for(j=1;j<=i;j++)
          {
                printf("%d",j);
          }
       printf("\n");
 }
getch();
}
--------------------------------------------------------
logics in mind:
----------------------
1)we have to display 1,2,3,4,5 so we use loop.
 2)since the displays are in repetitive form ,,we set up the loop in nested form such that
        internal loop executes 5 times with display of numbers(above).
3)First loop(outer) takes value 5 and assigns to inner.The inner executes 5 times with display.
4)next time, the outer loop takes the value 4 and transfers to inner loop, it displays again and again.
and it goes on



        

program to display first 5 Armstrong numbers between 0 and 1000.

//program to display first 5 Armstrong numbers between 0 and 1000
//we are taking numbers with three digits
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int i=1,rem,k,sum=0,count=0;
while(i<=1000)
{
     k=i;
     sum=0;
while(k!=0)
  {
    rem=k%10;
    sum=sum+pow(rem,3);
    k=k/10;
  }

 if(sum==i)
 {
          count++;
           if(count<=5)
               {   printf("%d\n",i);
                }  }
 sum=0;
 i++;

}
getch();
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:-
-------------------
->we have to display Armstrong numbers in given range 0 and 1000.Armstrong can be for 3/4 digits numbers.
   Here we taking 3 digits only.
->First  we take first number (k) then we apply following method        
                  ->For this, 
                 ->we have to divide by 10 to get last digit as remainder 
                 ->we find its cube and then go for sum
                -> to get second digit, we get first 12 and for this , we use 123/10.It is done to get integer                           part  only.
                  ->then we compare the number 'i' with that sum. If they are same then we display that.
->We repeat this until the value reaches 0 and for all numbers and individually. We use loop for this as shown above in the code.     
->as the first number is checked, we , once again, assign value '0' to sum to check next value.And this goes on. 
->while displaying Armstrong number, we also count it.If it is less than/equal to 5 then we display that.

program to display all Armstrong numbers between 0 and 100 solution here we are taking Armstrong number with 3 digit. but more digit also can be taken

//armstrong numbers lying in given range 0 and 1000
//we are taking numbers with three digits
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int i=1,rem,k,sum=0;
while(i<=1000)
{
     k=i;
     sum=0;
while(k!=0)
 {
   rem=k%10;
   sum=sum+pow(rem,3);
   k=k/10;
 }

if(sum==i)
{
      printf("%d\n",i);

}
sum=0;
 i++;

}
getch();
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:-
-------------------
->we have to display Armstrong numbers in given range 0 and 1000.Armstrong can be for 3/4 digits numbers.
   Here we taking 3 digits only.
->First  we take first number (k) then we apply following method        
                  ->For this, 
                 ->we have to divide by 10 to get last digit as remainder 
                 ->we find its cube and then go for sum
                -> to get second digit, we get first 12 and for this , we use 123/10.It is done to get integer                           part  only.
                  ->then we compare the number 'i' with that sum. If they are same then we display that.
->We repeat this until the value reaches 0 and for all numbers and individually. We use loop for this as shown above in the code.     
->as the first number is checked, we , once again, assign value '0' to sum to check next value.And this goes on.