Program Power Of A Given Number

Program Power Of A Given Number

Power of given number program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Power Of Given Number
      Filename : power.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int num, base, power, i=1;

         printf("Enter the number: ");
           scanf("%d",&num);
         printf("Enter the base: ");
           scanf("%d",&base);

           power=num;
         while(i<base);
         {
               
                 power=power*num;     
                  i++; 

         }      
         printf("Power of %d of base %d is %d",num,base,power);
          return(1);
  
 

Output :

  Enter the number: 5
  Enter the base: 2
  Power of 5 of base 2 is 25


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Sum Of First N Odd Natural Number

Program Sum Of First N Odd Natural Number

Sum of first N even natural number program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Sum of N odd natural  number
      Filename : sumOddNo.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int oddsum=0, i=1, num, tovalue;

         printf("Enter value for N: ");
           scanf("%d",&num);
           tovalue=num*2;
         while(i<tovalue);
         {
                if(i%2!=0)
                     {
                         oddsum=oddsum+i;
                     }      
                  i++; 

         }      
         printf("Sum of  %d odd No is %d: ",num,oddsum);
          return(0);
  
 

Output :

  Enter value for N: 3
  Sum of 5 odd No is: 9


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Sum Of First N Even Natural Number

Program Sum Of First N Even Natural Number

Sum of first N even natural number program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Sum of N even natural  number
      Filename : sumEvenNo.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int evensum=0, i=2, num, tovalue;

         printf("Enter value for N: ");
           scanf("%d",&num);
           tovalue=num*2;
         while(i<=tovalue);
         {
                if(i%2==0)
                     {
                         evensum=evensum+i;
                     }      
                  i++; 

         }      
         printf("Sum of  %d even No is %d: ",num,evensum);
          return(0);
  
 

Output :

  Enter value for N: 5
  Sum of 5 even No is: 30


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Of Factorial Of A Given Number

Program Of Factorial Of A Given Number

Factorial of a given number program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : factorial of a number
      Filename : factorial.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int fact=1, i=1,num;

         printf("Enter a number : ");
           scanf("%d",&num);
         if(num==0);
        else
         {
             while(i<=num)
                { 
                   fact=fact*i;
                   i++;      
                 }

        }      
         printf("Factorial of %d is %d",num,fact);
          return(0);
  
 

Output :

  Enter a number: 5
  Factorial of 5 is 120 


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Product Of First N Natural Number

Program Product Of First N Natural Number

Product of first N natural numbers program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Sum Of First N Natural Numbers
      Filename : productNNaturalNum.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int product=1,num,i=1;
         printf("Enter a value for N : ");
           scanf("%d",&num);
         while(i<=num)
           { 
                product=product*i;
                 i++;      
         
         printf("Product of N number is=%d",product);
          return(0);
  
 

Output :

  Enter a value for N :8
  Product of N Number is=40320 


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Sum Of First N Natural Numbers

Program Sum Of First N Natural Numbers

Sum of first N natural numbers program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Sum Of First N Natural Numbers
      Filename : sumNNaturalNum.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int sum=0,num,i=1;
         printf("Enter a value for N : ");
           scanf("%d",&num);
         while(i<=num)
           { 
                sum=sum+i;
                 i++;      
         
         printf("Sum of N number is=%d",sum);
          return(0);
  
 

Output :

  Enter a value for N :10
  Sum of N Number is=55 


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Print N Even Natural Number By User Input

Program Print N Even Natural Number By User Input

Check whether  a  number is divisible by 5 or not program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Print N Even Natural Number
      Filename : evenNnumber.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int num, i, count=0;
         printf("Enter a value for N : ");
           scanf("%d",&num);
         while(1)
           { 
                 if(i%2==0)
                  {
                       count++;
                         printf("%d \n",i);
                  } 
                    i++;
                if(count==num)
                  {
                     break;  
                   }
         
          return(0);
  
 

Output :

  Enter a value for N :15
    2
    4
    6
    8
    10
    12
    14
    16
    18
    20
    22
    24
    26
    28
    30
   


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program To Check Whether  A Number Is Divisible By 5 or Not

Program To Check Whether A Number Is Divisible By 5 or Not

Check whether  a  number is divisible by 5 or not program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Check Number Divisible By 5 Or Not
      Filename : divisibleby5.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int num;
         printf("Enter a number : ");
           scanf("%d",&num);
         if(year%5==0)
           {
                printf("%d is divisible by 5 \n",num);
           }
          else
           {
                printf("%d is not divisible by 5 \n",num); 
           } 
          return(0);
  
 

Output :

  Enter a number : 220
  220 is divisible by 5

  again run-:

  Enter a number :31
  31 is not divisible by 5



   




Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program Print N Natural No. In Reverse Order By User Input

Program Print N Natural No. In Reverse Order By User Input

Print N natural number in reverse order program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Check Number Divisible By 10 Or Not
      Filename : divisibleby10.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int num;
         printf("Enter a number : ");
           scanf("%d",&num);
         while(num!=0)
           {
                printf("%d \n",num);
                num--;
           }
         return(0);
  

Output :

  Enter a number :15
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  15
  


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program To Check Whether  A Number Is Divisible By 10 or Not

Program To Check Whether A Number Is Divisible By 10 or Not

Check whether  a  number is divisible by 10 or not program in C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Check Number Divisible By 10 Or Not
      Filename : divisibleby10.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int num;
         printf("Enter a number : ");
           scanf("%d",&num);
         if(year%10==0)
           {
                printf("%d is divisible by 10 \n",num);
           }
          else
           {
                printf("%d is not divisible by 10 \n",num); 
           } 
          return(0);
  
 

Output :

  Enter a number : 21
  21 is not divisible by 10

  again run-:

  Enter a number :20
  20 is divisible by 10



   




Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.


Program To Check Whether A Year Leap Or Not

Program To Check Whether A Year Leap Or Not

Check whether a year leap year or not leap year
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.



  /*
      Program : Print Hello World
      Filename : helloworld.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
  */
  #include<stdio.h>
  int main()
   {
        int year;
         printf("Enter a year : ");
           scanf("%d",&year);
         if(year%4==0)
           {
                printf("%d is leap year",year);
           }
          else
           {
                printf("%d is not leap year",year); 
           } 
          return(0);
       

Output :

  Enter a year : 2020
  2020 is leap year




Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.

Program Of Print First 10 Odd Natural Numbers

Program Of Print First 10 Odd Natural Numbers

Program Of Print First 10 Odd Natural Numbers In C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.

                                                                 

/* first 10 odd natural number */
#include<stdio.h>
int main()
{
    int i,count=0;
     for(i=1;1;i++)
       {
           if(i%2!=0)
            {
                  count++;
                  printf("%d\n",i);
                   if(count==10)
                      break;
            }
       }
}


Output:  

1
3
5
7
9
11
13
15
17
19
 
 


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.
Every programmer and learner first of all print Hello world! Program while they start learning
a programming language. So we are going to print Hello World! on the console output
screen.
#0: \*First program in C to print Hello World! text the console output screen */
This statement are called comment. We write comment in C programming language by using /* */ this symbols and writes somethings message within these symbols. We write the
comment about program and statement of that program to remember written statements and logic after sometimes. The comments have lot’s advantages in the programming, we
will learn more about comments in the others post.
#1: #include <stdio.h>
stdio.h is called header file which contains declarations of standard input, output related
library functions of the C programming language, this statement is write here to tells the
compiler to include the declarations of all standard input, output library functions which are
stored inside the header file stdio.h. We will learn more about header file in the other post.
#2: int main()
 main is a pre-declared functions in the C language which is defined by the programmer
 while writing a program, to run or execute the program.The main function is declared in the
 C language but we can define in our way. The main function is necessary to execute or run
 the program, without main function we cannot execute our program. The main function is
 starting point to the start executing our program. We will learn more about function and their declaration in the others post.
#3: printf(“Hello World!”);
“Hello World!” is sequence of the characters that are called string in the C programming
 language that are pass to the printf function to display text "Hello World!" on the console
 output screen(monitor). printf is a library function that is responsible to display text on the 
 standard output device in the C programming language. printf function is declared in header
 file stdio.hWill will learn more about input and output related function in the other post.
#4: { }
 These symbols are used to create blocks of function, if ,if-else, looping, switch, structure ,union others statements in the C programming language. The block are collection of codes 
 or statements to a particular function and others statements.
 #5: return 0;
 return (0);this statement is returning the control of this program to the calling function or
 system that is our operating system because main function is called by the operating   system in the C programming language. We will learn more about calling function in the
  others post. with value 0 return value 0 represent that’s program’s execution complete
  successfully.
  




Program Of Print First 10 Even Natural Numbers

Program Of Print First 10 Even Natural Numbers

Program Of Print First 10 Even Natural Numbers In C
This is our first program in C programming language. This C program will print the text
“Hello World!” on the console output screen. In this post we will learn how to 
write a C Program and explore each statements in this C Program and many more.

                                                                 

/* first 10 even natural number */
#include<stdio.h>
int main()
{
    int i,count=0;
     for(i=2;1;i++)
       {
           if(i%2==0)
            {
                  count++;
                  printf("%d\n",i);
                   if(count==10)
                      break;
            }
       }
}


Output:  

2
4
6
8
10
12
14
16
18
20


Explanation Of Each Statements In The Program:-
To learn any programming language, practical is must important than others factors. First of
all we learn and understand the language and then we implements, each things related to 
the language and explore about it. After all we are interested in making products (Software)
by using that language.
Every programmer and learner first of all print Hello world! Program while they start learning
a programming language. So we are going to print Hello World! on the console output
screen.
#0: \*First program in C to print Hello World! text the console output screen */
This statement are called comment. We write comment in C programming language by using /* */ this symbols and writes somethings message within these symbols. We write the
comment about program and statement of that program to remember written statements and logic after sometimes. The comments have lot’s advantages in the programming, we
will learn more about comments in the others post.
#1: #include <stdio.h>
stdio.h is called header file which contains declarations of standard input, output related
library functions of the C programming language, this statement is write here to tells the
compiler to include the declarations of all standard input, output library functions which are
stored inside the header file stdio.h. We will learn more about header file in the other post.
#2: int main()
 main is a pre-declared functions in the C language which is defined by the programmer
 while writing a program, to run or execute the program.The main function is declared in the
 C language but we can define in our way. The main function is necessary to execute or run
 the program, without main function we cannot execute our program. The main function is
 starting point to the start executing our program. We will learn more about function and their declaration in the others post.
#3: printf(“Hello World!”);
“Hello World!” is sequence of the characters that are called string in the C programming
 language that are pass to the printf function to display text "Hello World!" on the console
 output screen(monitor). printf is a library function that is responsible to display text on the 
 standard output device in the C programming language. printf function is declared in header
 file stdio.hWill will learn more about input and output related function in the other post.
#4: { }
 These symbols are used to create blocks of function, if ,if-else, looping, switch, structure ,union others statements in the C programming language. The block are collection of codes 
 or statements to a particular function and others statements.
 #5: return 0;
 return (0);this statement is returning the control of this program to the calling function or
 system that is our operating system because main function is called by the operating   system in the C programming language. We will learn more about calling function in the
  others post. with value 0 return value 0 represent that’s program’s execution complete
  successfully.