0% found this document useful (0 votes)
51 views3 pages

Function With No Arguments and No Return Value in C: #Include

The document discusses different types of functions in C programming: 1) A function with no arguments and no return value that calculates and prints the area of a circle given a radius. 2) A function with an argument (radius) and no return value that calculates and prints the area of a circle. 3) A function with an integer argument, that returns a float value (area) by calculating the area of a circle given the radius.

Uploaded by

saurabh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views3 pages

Function With No Arguments and No Return Value in C: #Include

The document discusses different types of functions in C programming: 1) A function with no arguments and no return value that calculates and prints the area of a circle given a radius. 2) A function with an argument (radius) and no return value that calculates and prints the area of a circle. 3) A function with an integer argument, that returns a float value (area) by calculating the area of a circle given the radius.

Uploaded by

saurabh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Function with no arguments and no Return Value In C

#include<stdio.h>
void area(); // Prototype Declaration
void main()
{
area();
}
void area()
{
float area_circle;
float rad;
printf("\nEnter the radius : ");
scanf("%f",&rad);
area_circle = 3.14 * rad * rad ;
printf("Area of Circle = %f",area_circle);
}

FUNCTION WITH ARGUMENTS AND NO RETURN VALUE :


#include<stdio.h>

#include<conio.h>
//---------------------------------------void area(float rad); // Prototype Declaration
//---------------------------------------void main()
{
float rad;
printf("nEnter the radius : ");
scanf("%f",&rad);
area(rad);
getch();
}
//---------------------------------------void area(float rad)
{
float ar;
ar = 3.14 * rad * rad ;
printf("Area of Circle = %f",ar);
}

Function with argument and return type


#include<stdio.h>
float calarea(int);
int main()
{
int radius;
float area;
printf("\nEnter the radius of the circle : ");
scanf("%d",&radius);
area = calarea(radius);
printf("\nArea of Circle : %f ",area);
return(0);

}
float calarea(int radius)
{
float areaOfCircle;
areaOfCircle = 3.14 * radius * radius;
return(areaOfCircle);
}

You might also like