SlideShare une entreprise Scribd logo
1  sur  17
C- PROGRAMMING 
FUNCTION
NOTES
System Define function 
#include<stdio.h> 
#include<conio.h> 
#include<math.h> 
void main() 
{ 
int num; 
float r; 
clrscr(); 
printf(“Enter any non”); 
scanf(“%d”,&num); 
r=sqrt(num); 
printf(“root of %d is %f n”, num,r); 
getch(); 
} 
EXTRA
NOTES
NOTES
User Define Function 
#include<stdio.h> Parameter and no return value 
#include<conio.h> 
void add(int, int); 
void main() 
{ 
int a,b; 
clrscr(); 
printf(“Enter two numbern”); 
scanf(“%d%d”,&a,&b); 
printf(“Value of A =%dn”,a); 
printf(“Value of B =%dn”,b); 
add(a,b); 
getch(); 
} no return 
void add(int x, int y) 
{ with Parameter 
int z; 
z=x+y; 
printf(“Sum of two no = %dn”,z); 
} 
EXTRA
User Define Function 
#include<stdio.h> Parameter and return value 
#include<conio.h> 
int add(int, int); 
void main() 
{ 
int a,b,c; 
clrscr(); 
printf(“Enter two numbern”); 
scanf(“%d%d”,&a,&b); 
printf(“Value of A =%dn”,a); 
printf(“Value of B =%dn”,b); 
c=add(a,b); 
printf(“Sum of two no = %dn”,c); 
getch(); 
} with return 
int add(int x, int y) 
{ with parameter 
int z; 
z=x+y; 
return z; 
} 
EXTRA
User Define Function 
No #include<stdio.h> Parameter and no return value 
#include<conio.h> 
void disp(); 
void main() 
{ 
clrscr(); 
disp(); 
getch(); 
} no return 
void disp() 
{ no parameter 
int a,b,c; 
printf(“Enter two numbern”); 
scanf(“%d%d”,&a,&b); 
printf(“Value of A =%dn”,a); 
printf(“Value of B =%dn”,b); 
c=a+b; 
printf(“Sum of two no = %dn”,c); 
getch(); 
} 
EXTRA
User Define Function 
No Parameter and return value 
#include<stdio.h> 
#include<conio.h> 
int fact(); 
void main() 
{ 
clrscr(); 
printf("Factorial %d",fact()); 
getch(); 
} with return 
int fact() 
{ no parameter 
int n,f=1; 
printf(" Enter any numbern"); 
scanf("%d",&n); 
while(n>=1) 
{ 
f=n*f; 
n--; 
} 
return f; 
} 
EXTRA
User Define Function 
Call by value method 
#include<stdio.h> 
#include<conio.h> 
void disp (int , int); 
void main() 
{ 
int a,b; 
clrscr(); 
printf(“Enter the Value of a & bn”); 
scanf(“%d%d”,&a,&b); 
printf(“Value of a before function %dn”,a); 
printf(“Value of b before function %dn”,b); 
disp(a,b); 
printf(“value of a after function %dn”,a); 
printf(“Value of b after function %dn”,b); 
getch(); 
} 
void disp(int a, int b) 
{ 
a=a+10; 
b=b+10; 
printf(“Value of a inside function %dn”,a); 
printf(“value of b inside function %dn”,b); 
} 
EXTRA
User Define Function 
Call by reference method 
#include<stdio.h> 
#include<conio.h> 
void disp (int &, int&); 
void main() 
{ 
int a,b; 
clrscr(); 
printf(“Enter the Value of a & bn”); 
scanf(“%d%d”,&a,&b); 
printf(“Value of a before function %dn”,a); 
printf(“Value of b before function %dn”,b); 
disp(a,b); 
printf(“value of a after function %dn”,a); 
printf(“Value of b after function %dn”,b); 
getch(); 
} 
void disp(int &a, int &b) 
{ 
a=a+10; 
b=b+10; 
printf(“Value of a inside function %dn”,a); 
printf(“value of b inside function %dn”,b); 
} 
EXTRA
NOTES
EXTRA
EXTRA
EXTRA
EXTRA
#include<stdio.h> 
#include<conio.h> 
int table(int,int); 
void main() 
{ 
int n,y=1,t; 
clrscr(); 
printf("Enter any non"); 
scanf("%d",&n); 
table(n,y); 
getch(); 
} 
int table(int n, int y) 
{ int t; 
if(y==11) 
{ 
return 0; 
} 
else 
{ t=n*y; 
printf("%d*%d=%dn",n,y,t); 
table(n,y+1); 
} 
return t; 
} 
EXTRA

Contenu connexe

Tendances

Programming Fundamentals Decisions
Programming Fundamentals  Decisions Programming Fundamentals  Decisions
Programming Fundamentals Decisions imtiazalijoono
 
Call by value
Call by valueCall by value
Call by valueDharani G
 
Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functionsvinay arora
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6Rumman Ansari
 
Function in c language(defination and declaration)
Function in c language(defination and declaration)Function in c language(defination and declaration)
Function in c language(defination and declaration)VC Infotech
 
functions in C and types
functions in C and typesfunctions in C and types
functions in C and typesmubashir farooq
 
Presentation on function
Presentation on functionPresentation on function
Presentation on functionAbu Zaman
 
Types of function call
Types of function callTypes of function call
Types of function callArijitDhali
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#khush_boo31
 
Pre defined Functions in C
Pre defined Functions in CPre defined Functions in C
Pre defined Functions in CPrabhu Govind
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings imtiazalijoono
 
Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Dharma Kshetri
 

Tendances (20)

Function lecture
Function lectureFunction lecture
Function lecture
 
Programming Fundamentals Decisions
Programming Fundamentals  Decisions Programming Fundamentals  Decisions
Programming Fundamentals Decisions
 
Function in c
Function in cFunction in c
Function in c
 
Call by value
Call by valueCall by value
Call by value
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Function
FunctionFunction
Function
 
C Prog - Functions
C Prog - FunctionsC Prog - Functions
C Prog - Functions
 
C function presentation
C function presentationC function presentation
C function presentation
 
Functions
FunctionsFunctions
Functions
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
 
C and C++ functions
C and C++ functionsC and C++ functions
C and C++ functions
 
Function in c language(defination and declaration)
Function in c language(defination and declaration)Function in c language(defination and declaration)
Function in c language(defination and declaration)
 
Functions
FunctionsFunctions
Functions
 
functions in C and types
functions in C and typesfunctions in C and types
functions in C and types
 
Presentation on function
Presentation on functionPresentation on function
Presentation on function
 
Types of function call
Types of function callTypes of function call
Types of function call
 
parameter passing in c#
parameter passing in c#parameter passing in c#
parameter passing in c#
 
Pre defined Functions in C
Pre defined Functions in CPre defined Functions in C
Pre defined Functions in C
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)Maharishi University of Management (MSc Computer Science test questions)
Maharishi University of Management (MSc Computer Science test questions)
 

En vedette

En vedette (20)

C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
C programming string
C  programming stringC  programming string
C programming string
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
C string
C stringC string
C string
 
Strings in C
Strings in CStrings in C
Strings in C
 
C programming - String
C programming - StringC programming - String
C programming - String
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Java script
Java scriptJava script
Java script
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRY
 
COMPUTER Tips ‘n’ Tricks
COMPUTER Tips ‘n’   TricksCOMPUTER Tips ‘n’   Tricks
COMPUTER Tips ‘n’ Tricks
 
1 tally basic
1 tally basic1 tally basic
1 tally basic
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net ii
 
Computer development
Computer developmentComputer development
Computer development
 
TALLY 1 st level entry
TALLY 1 st level entryTALLY 1 st level entry
TALLY 1 st level entry
 
C programming file handling
C  programming file handlingC  programming file handling
C programming file handling
 
Multimedia basic
Multimedia basicMultimedia basic
Multimedia basic
 
Php opps
Php oppsPhp opps
Php opps
 
TALLY Pos ENTRY
TALLY Pos ENTRYTALLY Pos ENTRY
TALLY Pos ENTRY
 
Application software
Application softwareApplication software
Application software
 

Similaire à C programming function

Similaire à C programming function (20)

C basics
C basicsC basics
C basics
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 
C Programming lab
C Programming labC Programming lab
C Programming lab
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
C Programming
C ProgrammingC Programming
C Programming
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Session06 functions
Session06 functionsSession06 functions
Session06 functions
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
 
Fucntions & Pointers in C
Fucntions & Pointers in CFucntions & Pointers in C
Fucntions & Pointers in C
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Pnno
PnnoPnno
Pnno
 
C programs
C programsC programs
C programs
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 

Plus de argusacademy (20)

Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
 
Html table
Html tableHtml table
Html table
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
 
Html level ii
Html level  iiHtml level  ii
Html level ii
 
Html frame
Html frameHtml frame
Html frame
 
Html forms
Html formsHtml forms
Html forms
 
Html creating page link or hyperlink
Html creating page link or hyperlinkHtml creating page link or hyperlink
Html creating page link or hyperlink
 
Html basic
Html basicHtml basic
Html basic
 
Php string
Php stringPhp string
Php string
 
Php session
Php sessionPhp session
Php session
 
Php oops1
Php oops1Php oops1
Php oops1
 
Php if else
Php if elsePhp if else
Php if else
 
Php creating forms
Php creating formsPhp creating forms
Php creating forms
 
Php create and invoke function
Php create and invoke functionPhp create and invoke function
Php create and invoke function
 
Php basic
Php basicPhp basic
Php basic
 
Php array
Php arrayPhp array
Php array
 
Sql query
Sql querySql query
Sql query
 
Rdbms
RdbmsRdbms
Rdbms
 
Oracle
OracleOracle
Oracle
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
 

Dernier

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 

Dernier (20)

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

C programming function

  • 3. System Define function #include<stdio.h> #include<conio.h> #include<math.h> void main() { int num; float r; clrscr(); printf(“Enter any non”); scanf(“%d”,&num); r=sqrt(num); printf(“root of %d is %f n”, num,r); getch(); } EXTRA
  • 6. User Define Function #include<stdio.h> Parameter and no return value #include<conio.h> void add(int, int); void main() { int a,b; clrscr(); printf(“Enter two numbern”); scanf(“%d%d”,&a,&b); printf(“Value of A =%dn”,a); printf(“Value of B =%dn”,b); add(a,b); getch(); } no return void add(int x, int y) { with Parameter int z; z=x+y; printf(“Sum of two no = %dn”,z); } EXTRA
  • 7. User Define Function #include<stdio.h> Parameter and return value #include<conio.h> int add(int, int); void main() { int a,b,c; clrscr(); printf(“Enter two numbern”); scanf(“%d%d”,&a,&b); printf(“Value of A =%dn”,a); printf(“Value of B =%dn”,b); c=add(a,b); printf(“Sum of two no = %dn”,c); getch(); } with return int add(int x, int y) { with parameter int z; z=x+y; return z; } EXTRA
  • 8. User Define Function No #include<stdio.h> Parameter and no return value #include<conio.h> void disp(); void main() { clrscr(); disp(); getch(); } no return void disp() { no parameter int a,b,c; printf(“Enter two numbern”); scanf(“%d%d”,&a,&b); printf(“Value of A =%dn”,a); printf(“Value of B =%dn”,b); c=a+b; printf(“Sum of two no = %dn”,c); getch(); } EXTRA
  • 9. User Define Function No Parameter and return value #include<stdio.h> #include<conio.h> int fact(); void main() { clrscr(); printf("Factorial %d",fact()); getch(); } with return int fact() { no parameter int n,f=1; printf(" Enter any numbern"); scanf("%d",&n); while(n>=1) { f=n*f; n--; } return f; } EXTRA
  • 10. User Define Function Call by value method #include<stdio.h> #include<conio.h> void disp (int , int); void main() { int a,b; clrscr(); printf(“Enter the Value of a & bn”); scanf(“%d%d”,&a,&b); printf(“Value of a before function %dn”,a); printf(“Value of b before function %dn”,b); disp(a,b); printf(“value of a after function %dn”,a); printf(“Value of b after function %dn”,b); getch(); } void disp(int a, int b) { a=a+10; b=b+10; printf(“Value of a inside function %dn”,a); printf(“value of b inside function %dn”,b); } EXTRA
  • 11. User Define Function Call by reference method #include<stdio.h> #include<conio.h> void disp (int &, int&); void main() { int a,b; clrscr(); printf(“Enter the Value of a & bn”); scanf(“%d%d”,&a,&b); printf(“Value of a before function %dn”,a); printf(“Value of b before function %dn”,b); disp(a,b); printf(“value of a after function %dn”,a); printf(“Value of b after function %dn”,b); getch(); } void disp(int &a, int &b) { a=a+10; b=b+10; printf(“Value of a inside function %dn”,a); printf(“value of b inside function %dn”,b); } EXTRA
  • 12. NOTES
  • 13. EXTRA
  • 14. EXTRA
  • 15. EXTRA
  • 16. EXTRA
  • 17. #include<stdio.h> #include<conio.h> int table(int,int); void main() { int n,y=1,t; clrscr(); printf("Enter any non"); scanf("%d",&n); table(n,y); getch(); } int table(int n, int y) { int t; if(y==11) { return 0; } else { t=n*y; printf("%d*%d=%dn",n,y,t); table(n,y+1); } return t; } EXTRA