Skip to content

Instantly share code, notes, and snippets.

@putheakhem
Created February 12, 2020 13:03
Show Gist options
  • Save putheakhem/5519d844702fe3b1d577cf87c44171a7 to your computer and use it in GitHub Desktop.
Save putheakhem/5519d844702fe3b1d577cf87c44171a7 to your computer and use it in GitHub Desktop.
Write a function that can calculate the summation of 3 integers
#include <stdio.h>
#include <stdlib.h>
// code will post in the description of our youtube .
// Write a function that can calculate the summation of 3 integers
int sum( int a, int b, int c) {
// we can declare new variable to store the result from a+b+c
int sum = 0;
sum = a + b + c;
return sum;
}
int main() {
int a, b, c;
printf("Enter value of a: ");
scanf("%d", &a);
printf("Enter value of b: ");
scanf("%d", &b);
printf("Enter value of c: ");
scanf("%d", &c);
printf("the result of a + b + c is : %d", sum(a, b, c));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment