SlideShare une entreprise Scribd logo
1  sur  11
Mubashir Farooq
1405(BScs)
GOVT Municipal Degree College FSD
Definition
A Function is a self-contained block of statement
that perform a task of some kind.
OR
Function is a set of instruction to carryout a
particular task.
Function after its execution returns a single value
when we call it in our program.
Functions in C
1.Built-in-Functions
• The built-in-function are
also called library function
or Standard Function. These
functions are
provided by programmer.
• printf(); and scanf(); are
Some common types of
built-in-Functions.
2.User-Defined Fun.
• Defined by user at the
time of writing the
program. User set these
program for her own
uses.
• Add(); Max(); etc are
some kinds of user-
defined functions.
Functions in C
Need of functions
• Enabling code reuse
• Better readability
• Improved debugging and testing
• Improved maintainability
• Reduce lines of code
Functions in C
Steps of User-Defined-F.
There are three steps of working with user
Defined functions:
1. Function Declaration, also known as function
prototype
2. Function Dentition means body of function.
3. Function use, also known as function call.
Functions in C
Programs.
• Simple program by Function :-
#include<stdio.h>
void massage();/*Function prototype declaration*/
void main()
{
void massage();/*function call*/
}
void massage()/*function definition*/
{
printf(“This is a simple program");
}
start
Function call
Void massag
Output
end
Out put :-
This is simple program
To find area and circumference of
circle.
#include<stdio.h>
#define PI 3.14159
float carea(float);
float ccir(float);
void main()
{ float radius;
printf("Enter floater Radius:");
scanf("%f",&radius);
carea(radius);
ccir(radius);
getch();
} float carea(float radius)
{ float area;
area=PI*radius*radius;
printf("Area= %fn",area);}
float ccir(float radius)
{ float ccir;
cir=2*PI*radius;
printf("Circumference= %f",cir);}
• Flo.
Programs.
start
Input radius
Function call
Float carea,crim
area=PI*radius*radius
cir=2*PI* radius
Output
Area,Cri
end
Enter floater Radius _5.0
Area=78.53975
Circumference=31.4159
To find area and circumference of
cube.
#include<stdio.h>
#define PI 3.14159
float carea(float);
float ccir(float);
void main()
{ float radius;
printf("Enter floater Radius:");
scanf("%f",&radius);
carea(radius);
ccir(radius);
getch();
} float carea(float radius)
{ float area;
area=4*PI*radius*radius;
printf("Area= %fn",area);}
float ccir(float radius)
{ float ccir;
cir=4/3*PI*radius*radius*radius*;
printf("Circumferernce= %f",cir);}
Programs. start
Input radius
Function call
Float carea,crim
area=4*PI*radius*radius
cir=4/3*PI* radius* radius*radius
Output
Area,Cir
end
Enter floater Radius _5.0
Area=1570.795
Circumference=523.59833335
To Exchange Values of 2 variables.
include<stdio.h>
void swap(int *x, int *y);
void main() {
int x, y;
printf("nEnter First number : ");
scanf("%d", &x);
printf("nEnter Second number : ");
scanf("%d", &y);
printf("nBefore Swaping x = %d and y = %d", x, y);
swap(&x, &y);
printf("nAfter Swaping x = %d and y = %d", x, y);
getch();}
void swap(int *x, int *y) {
int temp;
temp = *x;
*x = *y;
*y = temp;}
Programs. start
Input x,y
Output
Values of x and y
end
Function call
Void swap
Temp=*x
*x=*y
Y=*temp
Enter First number_4
Enter Second number_8
Before Swaping x=4 and y=8
After Swaping x=8 and y=4
If No
Question.???
by MF Malik

Contenu connexe

Tendances

Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)Ritika Sharma
 
OPERATOR OVERLOADING IN C++
OPERATOR OVERLOADING IN C++OPERATOR OVERLOADING IN C++
OPERATOR OVERLOADING IN C++Aabha Tiwari
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functionsHarsh Patel
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vishal Patil
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
 
Python functions
Python functionsPython functions
Python functionsAliyamanasa
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend classAbhishek Wadhwa
 
Call by value
Call by valueCall by value
Call by valueDharani G
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of ConstructorsDhrumil Panchal
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 
Functions in python
Functions in pythonFunctions in python
Functions in pythoncolorsof
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCEVenugopalavarma Raja
 
Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 

Tendances (20)

Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Array Of Pointers
Array Of PointersArray Of Pointers
Array Of Pointers
 
Function in c
Function in cFunction in c
Function in c
 
Friend function in c++
Friend function in c++ Friend function in c++
Friend function in c++
 
OPERATOR OVERLOADING IN C++
OPERATOR OVERLOADING IN C++OPERATOR OVERLOADING IN C++
OPERATOR OVERLOADING IN C++
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Python functions
Python functionsPython functions
Python functions
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
 
Call by value
Call by valueCall by value
Call by value
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
 

Similaire à Functions in C

5. Functions in C.pdf
5. Functions in C.pdf5. Functions in C.pdf
5. Functions in C.pdfsantosh147365
 
Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxKhurramKhan173
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and typesimtiazalijoono
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C ProgrammingShuvongkor Barman
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...kushwahashivam413
 
U19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptU19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptManivannan837728
 
Functions IN CPROGRAMMING OF ENGINEERING.pptx
Functions IN CPROGRAMMING OF ENGINEERING.pptxFunctions IN CPROGRAMMING OF ENGINEERING.pptx
Functions IN CPROGRAMMING OF ENGINEERING.pptxvanshhans21102005
 
USER DEFINED FUNCTIONS IN C.pdf
USER DEFINED FUNCTIONS IN C.pdfUSER DEFINED FUNCTIONS IN C.pdf
USER DEFINED FUNCTIONS IN C.pdfBoomBoomers
 
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxSangeetaBorde3
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg PatelTechNGyan
 

Similaire à Functions in C (20)

5. Functions in C.pdf
5. Functions in C.pdf5. Functions in C.pdf
5. Functions in C.pdf
 
FUNCTIONS.pptx
FUNCTIONS.pptxFUNCTIONS.pptx
FUNCTIONS.pptx
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptx
 
C structure
C structureC structure
C structure
 
Programming Fundamentals Functions in C and types
Programming Fundamentals  Functions in C  and typesProgramming Fundamentals  Functions in C  and types
Programming Fundamentals Functions in C and types
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
unit_2.pptx
unit_2.pptxunit_2.pptx
unit_2.pptx
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...
 
U19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).pptU19CS101 - PPS Unit 4 PPT (1).ppt
U19CS101 - PPS Unit 4 PPT (1).ppt
 
Functions IN CPROGRAMMING OF ENGINEERING.pptx
Functions IN CPROGRAMMING OF ENGINEERING.pptxFunctions IN CPROGRAMMING OF ENGINEERING.pptx
Functions IN CPROGRAMMING OF ENGINEERING.pptx
 
visiblity and scope.pptx
visiblity and scope.pptxvisiblity and scope.pptx
visiblity and scope.pptx
 
Functions
FunctionsFunctions
Functions
 
USER DEFINED FUNCTIONS IN C.pdf
USER DEFINED FUNCTIONS IN C.pdfUSER DEFINED FUNCTIONS IN C.pdf
USER DEFINED FUNCTIONS IN C.pdf
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
 
Unit 3 (1)
Unit 3 (1)Unit 3 (1)
Unit 3 (1)
 
Basics of c Nisarg Patel
Basics of c Nisarg PatelBasics of c Nisarg Patel
Basics of c Nisarg Patel
 

Dernier

eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 

Dernier (20)

eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 

Functions in C

  • 1.
  • 3. Definition A Function is a self-contained block of statement that perform a task of some kind. OR Function is a set of instruction to carryout a particular task. Function after its execution returns a single value when we call it in our program. Functions in C
  • 4. 1.Built-in-Functions • The built-in-function are also called library function or Standard Function. These functions are provided by programmer. • printf(); and scanf(); are Some common types of built-in-Functions. 2.User-Defined Fun. • Defined by user at the time of writing the program. User set these program for her own uses. • Add(); Max(); etc are some kinds of user- defined functions. Functions in C
  • 5. Need of functions • Enabling code reuse • Better readability • Improved debugging and testing • Improved maintainability • Reduce lines of code Functions in C
  • 6. Steps of User-Defined-F. There are three steps of working with user Defined functions: 1. Function Declaration, also known as function prototype 2. Function Dentition means body of function. 3. Function use, also known as function call. Functions in C
  • 7. Programs. • Simple program by Function :- #include<stdio.h> void massage();/*Function prototype declaration*/ void main() { void massage();/*function call*/ } void massage()/*function definition*/ { printf(“This is a simple program"); } start Function call Void massag Output end Out put :- This is simple program
  • 8. To find area and circumference of circle. #include<stdio.h> #define PI 3.14159 float carea(float); float ccir(float); void main() { float radius; printf("Enter floater Radius:"); scanf("%f",&radius); carea(radius); ccir(radius); getch(); } float carea(float radius) { float area; area=PI*radius*radius; printf("Area= %fn",area);} float ccir(float radius) { float ccir; cir=2*PI*radius; printf("Circumference= %f",cir);} • Flo. Programs. start Input radius Function call Float carea,crim area=PI*radius*radius cir=2*PI* radius Output Area,Cri end Enter floater Radius _5.0 Area=78.53975 Circumference=31.4159
  • 9. To find area and circumference of cube. #include<stdio.h> #define PI 3.14159 float carea(float); float ccir(float); void main() { float radius; printf("Enter floater Radius:"); scanf("%f",&radius); carea(radius); ccir(radius); getch(); } float carea(float radius) { float area; area=4*PI*radius*radius; printf("Area= %fn",area);} float ccir(float radius) { float ccir; cir=4/3*PI*radius*radius*radius*; printf("Circumferernce= %f",cir);} Programs. start Input radius Function call Float carea,crim area=4*PI*radius*radius cir=4/3*PI* radius* radius*radius Output Area,Cir end Enter floater Radius _5.0 Area=1570.795 Circumference=523.59833335
  • 10. To Exchange Values of 2 variables. include<stdio.h> void swap(int *x, int *y); void main() { int x, y; printf("nEnter First number : "); scanf("%d", &x); printf("nEnter Second number : "); scanf("%d", &y); printf("nBefore Swaping x = %d and y = %d", x, y); swap(&x, &y); printf("nAfter Swaping x = %d and y = %d", x, y); getch();} void swap(int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp;} Programs. start Input x,y Output Values of x and y end Function call Void swap Temp=*x *x=*y Y=*temp Enter First number_4 Enter Second number_8 Before Swaping x=4 and y=8 After Swaping x=8 and y=4