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.