c function example
Example 1: function in c
#include <stdio.h>
void function(){
printf("I am a function!");
}
int main(void) {
function();
}
Example 2: functions in c programming
#include <stdio.h>
void introduction()
{
printf("Hi\n");
printf("My name is Chaitanya\n");
printf("How are you?");
}
int main()
{
introduction();
return 0;
}
Example 3: functions in c programming
#include <stdio.h>
int addition(int num1, int num2)
{
int sum;
sum = num1+num2;
return sum;
}
int main()
{
int var1, var2;
printf("Enter number 1: ");
scanf("%d",&var1);
printf("Enter number 2: ");
scanf("%d",&var2);
int res = addition(var1, var2);
printf ("Output: %d", res);
return 0;
}