Top 10 Program in C Programming Language - Free Programming World

Latest

Sunday, January 31, 2021

Top 10 Program in C Programming Language

 Top 10 Program in C Programming Language 

In the Programming world, Today I am sharing with you the top 15 programs in c programming language.
top 15 programs in c programming language. ok So let's Start.



Top 15 Program in C Programming Language



(1)Hello World Program in C 

Guys Hello world program is a very basic program. But this is a very important program in our c programming learning journey. If we understand the basics of c programming syntax then it is very easy to understand the c programming.
Hello World program in C



#include<stdio.h>
 main()
{
printf("Hello, Free Programming World ");
}

Output:
Hello, Free Programming World 

#include : it is a preprocessor directory or command that tell the compiler to include the content of stdio.h

stdio.h:  stdio means  standard input output: stdio.h  file contain
function such as scanf and printf for take input and display output purpose.

printf : It is libraray Function to send output to the screen.

Main is the function where our program execution will be started.

(2)Factorial No Program In C Programming Language 

In this program, you will learn factorial no program in c programming language.So lets start...

Factorial Number of n = 1*2*3*4*5.....
Factorial No 5 = 5*4*3*2*1
Factorial No 4= 4*3*2*1
Factorial No 3= 3*2*1
Factorial No 2= 2*1
Factorial of 0& 1 = 1

Factorial no Program in C


#include<stdio.h>
int main()
{
int number,i;
long factorial=1;
printf("Enter an number you want to find factorial");
scanf("%d",&number);
if(number<0)
{
printf("Negative No Factorial Cant find factorial");
}
else
{
for(i=1;i<=number;++i)
{
factorial=factorial*i;
}
printf("Factorial of %d=%lu",number,factorial);
}
return 0;
}
 

Output:
Enter a number you want to find factorial: 7
Factorial: 5040

(3)Fibonacci Program in C

Hello Guys Today I am share with you one new program in c programming language.
Fibbonacci Sequence is sequence where the next term is sum of previous two.by default we use 0 and 1 in the fibbonaaci series.

#include<stdio.h>

int main()

{

    int number1=0;

    int number2=1;

    int number3;

    int i;

    int number;

    printf("Enter the number of element");

    scanf("%d",&number);

    printf("\n%d%d",number1,number2);

    for(i=2;i<number;++i)

    {

        number3=number1+number2;

        printf("%d",number3);

        number1=number2;

        number2=number3;

    }

    return 0;

}

 
Fibonacci program in c
Output:
Enter the number of element: 5
0 1 1 2 3
(4) Prime Number Program in C
Prime number in C: Prime number is a number that is greater than 1 and divided by 1 or itself. In other words, prime numbers can't be divided by other numbers than itself or 1. For example 2, 3, 5, 7, 11, 13, 17, 19, 23.... are the prime numbers

prime number program in c

(5) Palindrome Number Program in C

Palindrome number in c: A palindrome number is a number that is the same after reverse. For example 121, 151,161,34543, 343, 131, 48984 are the palindrome numbers.


palindrome number program in c


 (6)Armstrong Number Program in C

Armstrong number is a number that is equal to the sum of cubes of its digits. For example 0, 1, 153, 370, 371, and 407 are the Armstrong numbers.

Armstrong number program in c



(7)Sum of Digit program in C:

In this program, we write sum of each digit number program in c. 

Example: Input =123

                output: 6

sum of digit number program in c


(8)Reverse Number Program in C:

In this program, we will write a Reverse number program in c. We are getting the number as input from the user and reverse the number.
Example: Input: 456
                Output: 654
Program:
Reverse number program in c


(9)Swap two number using C Program 

In this program, we will write a swap two number program without using a third variable.

Example: Input a=10,b=20;

                Output a=20,b=10;

Swap number program in c

(10) Leap Year program in C
A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400.
Example: Input: 2020
                Output: 2020 is a leap year
leap year program in c


output leap year program in c















 


No comments:

Post a Comment