-->

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