In this, we are going to see the Functions that have no arguments but returns a value, this program we are going to see addition of two numbers using C Programming Language.
#include<stdio.h>
#include<stdlib.h>
int sum()
{
float a, b, sum;
printf("Enter 2 numbers:-\n");
printf("a = ");
scanf("%f", &a);
printf("b = ");
scanf("%f", &b);
sum = a+b;
return sum;
}
int main()
{
//This is used to clear your all previous outputs
system("cls");
float num;
num = sum();
printf("Sum of given 2 numbers are:- %f", num);
return 0;
}
//........Coded by YASH ALLAPURIA
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP