-->

program to print/display all factors of number 'n'.

 //program to print/display all factors of  number 'n'.
#include<stdio.h>
include<conio.h>
void main()
{
   int number,factors,i;
   printf("enter any positive number\n");
  scanf("%d",&number);
  for(i=1;i<=number;i++)
    {
      if(number%i==0)
        {                printf("the factors are=%d ",i);
        }getch();
}
--------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number whose factors value you want to find
->we have to go for repetitive process from number 1 to entered number 'number' i.e we divide given number 'number by 1,2,3... and itself. This we can apply using loop as shown above.If we get zero as remainder while dividing then we display that.

program to get factorial value of a positive number

//program to get factorial value of a positive number
#include<stdio.h>
include<conio.h>
void main()
{
   int number,fact=1,i;
   printf("enter any positive number\n");
  scanf("%d",&number);
if(number>0)

 for(i=1;i<=number;i++)
    {
     fact=fact*i;
   }
}
else
{
printf("the number is not +ve\n");
}
 printf("the factorial value for entered number=%d is =%d\n",number,fact);
getch();
}
------------------------------
logics in mind:
->enter a number whose factorial value you want to find
->we have to go for repetitive multiplication from number 1 to entered number 'number'. This we can apply using loop as shown above.
->display the final value of variable 'fact'.

   

program to convert hexadecimal number into binary number system.

//program to convert hexadecimal number into binary number system.
#include<stdio.h>
#define MAX 100
void main()
{
    char binaryNumber[MAX],hexaDecimal[MAX];
    long int i=0;

    printf("Enter any hexadecimal number: ");
    scanf("%s",hexaDecimal);

    printf("\nEquivalent binary value: ");
    while(hexaDecimal[i])
{
         switch(hexaDecimal[i])
      {
             case '0': printf("0000"); 
                              break;
             case '1': printf("0001"); 
                             break;
             case '2': printf("0010"); 
                             break;
             case '3': printf("0011"); 
                            break;
             case '4': printf("0100"); 
                             break;
             case '5': printf("0101"); 
                            break;
             case '6': printf("0110"); 
                           break;
             case '7': printf("0111"); 
                          break;
             case '8': printf("1000"); 
                           break;
             case '9': printf("1001"); 
                          break;
             case 'A': case 'a': printf("1010"); 
                         break;
             case 'B': case 'b': printf("1011"); 
                         break;
             case 'C': case 'c': printf("1100"); 
                         break;
             case 'D': case 'd': printf("1101"); 
                          break;
             case 'E': case 'e': printf("1110"); 
                         break;
             case 'F': case 'f': printf("1111"); 
                        break;
        
             default:  
                    printf("\nInvalid hexadecimal digit %c ",hexaDecimal[i]);

         }                           
         i++;
    }
    getch();

}
logics in mind/applied:
->we enter here hexadecimal number
->we make group of 4 bits equivalent of each digit
->for this, we check each digit.
->To check digit, we use loop and switch with each digit equivalent.


program to convert binary no. to hexadecimal number system.

//program to convert binary no. to hexadecimal number system.
#include<stdio.h>
#include<conio.h>
void main()
{
   
    long int binary_Number,hexadecimalNumber=0,j=1,remainder;
   
    printf("Enter any number any binary number: ");
    scanf("%ld",&binary_Number);
   
    while(binary_Number!=0)
{
    remainder=binary_Number%10;
    hexadecimalNumber=hexadecimalNumber+remainder*j;
        j=j*2;
        binary_Number=binary_Number/10;
      }

    printf("Equivalent hexadecimal value: %lX",hexadecimalNumber);

    getch();

}

-----------------------------------------------------------------------
logics in mind:-

->we have to input a binary number, say 111
->we make group of 3 bits from right side, and for this, we use 

hexdecimalNumber=hexadecimalNumber+remainder*j;