C program to add two number using function

So today we will learn “C program to add two number using string function” . First let me define “function” . If you want to learn about function then CLICK HERE .

If you are beginner in programming then visit following topics . Which help you to understand below program.

Switch Cases
Array and Types
– Function 

A function is a group of statement that together performs a specific task. So this is just a simple definition of the function .

Advantage of Function:

–  Code Re-usability.
–  Develop an application in module format.
–  Easy to debug the program.
–  Code optimization.
–  Code is easy to read.

So without delay let’s go programming.

C Program To Add Two Number Using String Function
void sum(); //declaring a function
 int a,b;
 printf("n Enter a number:");
 printf("n Enter a number:");
 sum();  //calling function getch(); 
void sum()  // defining functionint 
 int a,b,c=0;
 printf("n Sum:%d",c);




Enter number:10
Enter number:20

In the above program, we have just solved the simple problem to “C program to add two number using the function”. If you are getinnen then you may have one question i.e  What is going?

So I’m here to make you understand every program. In the program, we have solved to add number using the function . So we need to define return type function in the header . Then, as usual, taking an integer and ask the user to enter numbers. In this function we have use calling function i,e “sum()” . So which is used to print values when we return value from defining the function . Now we define defining a function and perform all mathematical operation and return value to calling function and print value as output .

Concept of function,function definition, function prototype

If you have any problem then you can comment below or visit my social media page contact me. I will be so pleased to help you and available 24 hours in your help  .


C program to read 2D array of size 2*3 from user and display it.
Function Concept function, function definition, function prototype.
C program to arrange given number in descending order using function.

You can solve this problem in this way too. Which give same result .

 C Program To Add Integer Using Function 


int sum(int);
 int n,c;
 printf("n Enter number:");
int sum(int n)
 int sum=0;
 for(int i=1;i<n;i++)

Other Problems: (do not forget to visit)

Program to find factorial of given number using loop for loop.
Write a menu driven program in C to find area and perimeter of rectangle .
C program to find samallest number among given three number



Leave a Reply

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

error: Content is protected !!