C Program to Write Custom Functions

Get Certified in C Programming and Take Your Skills to the Next Level

Program 1

#include<stdio.h>
#include<conio.h>
void display();  
void fact();   // Declare
void main()
{
   printf("\n Main Starts...");
    display();
    fact();  // Calling
   printf("\n Main Ends...");
}
void fact()  //Defination 
{
    int f=1,n;
    printf("\nEnter a Number");
    scanf("%d",&n);
    while(n!=0)
    {
        f=f*n;
        n--;
    }
    printf("\nFactoiral is %d: ",f);

}
void display()
{
    printf("\nThis is demo function in C Language");
}

 

Your opinion matters
Please write your valuable feedback about DataFlair on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *