google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to find the sum of two numbers using functions - 2nd puc computer science

Write a c program to find the sum of two numbers using functions

write a c program to find the sum of two numbers using functions,write a program to add two numbers using function,c program to add two numbers using user defined function

Write a c program to find the sum of two numbers using functions

#include<stdio.h>

#include<conio.h>

void main()

{

int add(int a, int b); //function prototype

int a,b,sum;

clrscr();

printf(“Enter two numbers:\n”);                         

scanf(“%d%d”,&a,&b);

sum=add(a,b); // function call

printf(“Sum=%d”,sum);

getch();

}

int add(int a, int b)

{

return(a+b);                                                      

}

Output:

Enter two numbers:

2                                                                              

3                                                                              

Sum=5
Write a c program to find the sum of two numbers using functions Write a c program to find the sum of two numbers using functions Reviewed by Vision Academy on December 13, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.