How to add two numbers with using function?

Answer Posted / anandi

#include<stdio.h>
#include<conio.h>
void main()
{
int add(int,int);
int a,b;
clrscr();
printf("Enter two numbers: ");
scanf("%d %d",&a,&b);
printf("The Sum is: %d",add(a,b));
getch();
}
int add(int x,int y)
{
return(x+y);
}

Is This Answer Correct ?    42 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how do you execute a c program in unix.

628


List some of the dynamic data structures in C?

775


What is the purpose of sprintf() function?

587


Differentiate between a for loop and a while loop? What are it uses?

658


A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler

614






Do you have any idea how to compare array with pointer in c?

588


What are pointers?

621


How to declare a variable?

557


Are pointers really faster than arrays?

552


Hi can anyone tell what is a start up code?

1602


Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1512


Who is the main contributor in designing the c language after dennis ritchie?

536


How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

15477


write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)

1617


How do you determine whether to use a stream function or a low-level function?

635