-->

WAP to get factorial value of a number.

//WAP to get factorial value of a number.
#include<stdio.h>
include<conio.h>
void main()
{
   int number,fact=1,i;
   printf("enter any positive number\n");
  scanf("%d",&number); 
 for(i=1;i<=number;i++)
    {
     fact=fact*i;
   }
 printf("the factorial value for entered number=%d is =%d\n",number,fact);
getch();
}
-----------------------------------------------------------------------------------
Or
-------------------------------------------------------------------------------
//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();
}

WAP to input salary of 'n'number of employees then count total number of employees getting salary in different range

//WAP to input salary of 'n'number of employees then count total number of employees getting salary in different //range
/*
-> less than 5000
 > >=5000 and < 10000
 >  >10000
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,count=0,count1=0,count2=0;
in salary[1000];
printf("enter total number of employees below 1000\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter salary\n");
scanf("%d",&salary[i]);
  if(salary[i]<5000)
   {
     count++;
    }
   else if(salary[i]>=5000 && salary[i]<=10000)
              {
                count1++;
              }
   else
     {
          count2++;
      }
}
printf("total emplyoees getting less than 5000=%d\n",count);
printf("total employees getting more or equals to 5000= and less than 10000=%d\n",count1);
printf("total emplyoees getting more than 10000=%d\n",count2);
getch();
}

WAP to display the name of day on the basis of entered number 1 to 7 using switch. For example, 1 for Sunday.

//WAP to display the name of day on the basis of entered number 1 to 7 using switch. For example, 1 //for  Sunday.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int choice;
int number,output;
printf("'we have following menu\n");
printf( "1.for Sunday\n");
printf("2. for Monday\n");
printf("3 for Tuesday\n");
printf("4 for Wednesday\n");
printf("5 for Thrusday\n");
printf("6 for Friday\n");
printf("7 for Saturday\n");
printf("enter your choice 1 or 2 or 3 or 4 or 5 or 6 or 7 or any other number to exit\n");
scanf("%d",&choice);
 switch(choice)
          {
                  case 1:
                            printf("It's Sunday\n");
                            
                break;
               case 2:
                            printf("It's Monday\n");
                 break;

               case 3:
                           printf("IT's Tuesday\n");                            
                 break;
             case 4:
                       printf("It's Wednesday\n");
            break;
          case 5:
                      printf("It's Thrusday\n");
          break;
           case 6:
                     printf("It's Friday\n");
            break;  
            case 7:
                        printf("It's Saturday\n");
           break; 
           default:
                            printf("sorry, not a valid input\n");
                            printf("thank u, terminating....\n");
          }
getch();
}

WAP to find sum,difference, and product of two numbers using switch.

//WAP to find sum,difference, and product of two numbers using switch.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int choice;
int a,b,output;
printf("please enter your two numbers for a and b for operation\n");
scanf("%d%d",&a,&b);
printf("'now,we have following menu\n");
printf( "1.to get sum\n");
printf("2. to get difference\n");
printf("3 to get product\n");
printf(" any other number to exit");
printf("enter your choice 1 or 2 or 3 or any other number\n");
scanf("%d",&choice);
 switch(choice)
          {
                  case 1:
                            printf("we are going to get sum\n");
                           printf("the sum=%d",a+b);
                 break;
               case 2:
                            printf("we are going to get difference \n");
                           printf("the difference=%d",a-b);
                 break;

               case 3:
                            printf("we are going to get product,\n");
                           printf("the product=%d",a*b);
                 break;
             
              default:
                            printf("sorry, not a valid input\n");
                            printf("thank u, terminating....\n");
          }
getch();
}

//program to get following pattern

/*program to get following pattern
                *
                * *
                * *  *
                * *  *  *
                * *  *  *  * 
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<=5;i++)
  {
     for(j=1;j<=i;j++)
          {
                printf("* ");
          }
       printf("\n");
 }
getch();
}

Using pointer, write a program to show addition,subtraction and division (arithmetic calculation ).

//Using pointer, write a program to show addition,subtraction and division (arithmetic                    calculation ).
#include<stdio.h>
#include<conio.h>
void main()
{
int *p,*p1;
int number,number1;
printf("enter a numbers\n");
scanf("%d%d",&number,&number1);
p=&number;
p1=&number1;
printf("the sum is=%d\n",*p+*p1);
printf("the difference is=%d\n",*p-*p1);
printf("the quotient is=%d\n",*p/*p1);
getch();
}

Program to input a value/number and display its address with value using pointer.

//WAP to input a value/number and display its address with value using pointer.
#include<stdio.h>
#include<conio.h>
void main()
{
int *p;
int number;
printf("enter a number\n");
scanf("%d",&number);
p=&number;
printf("the address is=%d\n",p);
printf("the value is=%d\n",*p);
getch();
}