-->

//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();
}

program to print 'n' integers and their factorial value.

//to print 'n' integers and their factorial value.
#include<stdio.h>
include<conio.h>
void main()
{
   int number,i,k,fact;
   printf("enter value(upper) for  number 'number'\n");
  scanf("%d",&number);
  for(i=1;i<=number;i++)
    {
        fact=1;
        for(k=1;k<=i;k++)
           {
                    fact=fact*k;
            }
            printf("the factorial value for %d number=%d\n",i,fact);
    }
getch();
}

program to get y raise to power x using user defined function.

//program to get y  raise to power x using user defined function.
#include<stdio.h>
#include<conio.h>
#include<math.h>
void powervalue();
void main()
{

powervalue();
getch();
}
void powervalue()
{
int x,y,output;
printf("enter base value\n");
scanf("%d",&x);
printf("enter power value\n");
scanf("%d",&y);
output=pow(x,y);
printf("the output =%d\n",output);
getch();
}

program to get sum of 'n' integers using function.

//program to get sum of 'n' integers using function.
#include<stdio.h>
#include<conio.h>
void sum();
void main()
{

sum();
getch();
}
void sum()
{int k=1,n,sum=0;
printf("enter value of 'n'\n");
scanf("%d",&n);
while(k<=n)
   {
      sum=sum+k;
      k++;
   }
printf("sum=%d",sum);
}

program to get/sum of all odd numbers lying between 1 to n natural numbers

//program  to get/sum of all odd numbers lying between 1 to n natural numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int k=0,n,sum=0;                         
printf("enter value of 'n'\n");
scanf("%d",&n);
while(k<=n)
   {
      if(k%2!=0)
      {      sum=sum+k;
      }
    k++;
   }
printf("the sum=%d",sum);

getch();
}

-----------------------------
we can also write this program as shown below.
-------------------------------------
//program  to get/sum of all odd numbers lying between 1 to n natural numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int k=1,n,sum=0;                         
printf("enter value of 'n'\n");
scanf("%d",&n);
while(k<=n)
   {
            sum=sum+k;
      
    k=k+2;
   }
printf("the sum=%d",sum);
getch();
}