Thursday , September 21 2017
Home / C / C program to add two numbers using for loop

C program to add two numbers using for loop

C program to add two numbers using for loop | Sum of two numbers using for loop : This is a c program to add two numbers using for loop to know more concept about the looping and conditional control statements. 

Also Read : C program for sum of two numbers using while loop

#CODE for Sum of two numbers using for loop and functions

#include <stdio.h>

int sum(int, int);
int main() {
   int a, b;

   printf("Enter the two Numbers: ");
   scanf("%d %d", &a, &b); 

   printf("Addition of two num. is : %d", sum(a, b));
   return(0);
}

int sum(int num1, int num2) {
   int i;
   for (i = 0; i < num2; i++)
      num1++;
   return num1;
}

OUTPUT:

Enter the two numbers: 12 3
Addition of two num. is : 15

Incoming terms:

Write a program in C to add two numbers using for loop

WAP to add two numbers using for loop

 

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

Leave a Reply

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