Functions allow programmers to break programs into smaller, reusable parts. There are two types of functions in C: library functions and user-defined functions. User-defined functions make programs easier to understand, debug, test and maintain. Functions are declared with a return type and can accept arguments. Functions can call other functions, allowing for modular and structured program design.
The document discusses functions in C programming. It defines functions as self-contained blocks of code that perform a specific task. Functions make a program more modular and easier to debug by dividing a large program into smaller, simpler tasks. Functions can take arguments as input and return values. Functions are called from within a program to execute their code.
This document discusses different types of functions in C programming. It defines library functions, user-defined functions, and the key elements of functions like prototypes, arguments, parameters, return values. It categorizes functions based on whether they have arguments and return values. The document also explains how functions are called, either by value where changes are not reflected back or by reference where the original values are changed.
A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
The document discusses functions in C programming. The key points are:
1. A function is a block of code that performs a specific task. Functions allow code reusability and modularity.
2. main() is the starting point of a C program where execution begins. User-defined functions are called from main() or other functions.
3. Functions can take arguments and return values. There are different ways functions can be defined based on these criteria.
4. Variables used within a function have local scope while global variables can be accessed from anywhere. Pointers allow passing arguments by reference.
Recursion is a process where an object is defined in terms of smaller versions of itself. It involves a base case, which is the simplest definition that cannot be further reduced, and a recursive case that defines the object for larger inputs in terms of smaller ones until the base case is reached. Examples where recursion is commonly used include defining mathematical functions, number sequences, data structures, and language grammars. While recursion can elegantly solve problems, iterative algorithms are generally more efficient.
The document presents information about functions in the C programming language. It discusses what a C function is, the different types of C functions including library functions and user-defined functions. It provides examples of how to declare, define, call and pass arguments to C functions. Key points covered include how functions allow dividing a large program into smaller subprograms, the ability to call functions multiple times, and how functions improve readability, debugging and reusability of code. An example program demonstrates a simple C function that calculates the square of a number.
This document discusses string library functions in C programming. It defines what strings are as null-terminated arrays of characters. It then lists and describes common string functions - strlen() returns the length of a string, strcmp() compares two strings, strcpy() copies one string to another, and strcat() concatenates two strings. Examples are provided for each function.
The document discusses functions in C programming. It defines a function as a self-contained block of code that performs a specific task. Functions make code more modular and reusable. There are two types of functions: standard/library functions and user-defined functions. Functions can take input parameters and return values. Functions are an essential part of program structure in C as they help organize code and logic.
Constructor is a special member function that initializes objects of a class. Constructors have the same name as the class and do not have a return type. There are two types of constructors: default constructors that take no parameters, and parameterized constructors that allow passing arguments when creating objects. Constructors are automatically called when objects are created to initialize member variables, unlike regular member functions which must be explicitly called.
The document discusses C functions, including their definition, types, uses, and implementation. It notes that C functions allow large programs to be broken down into smaller, reusable blocks of code. There are two types of functions - library functions and user-defined functions. Functions are declared with a return type, name, and parameters. They are defined with a body of code between curly braces. Functions can be called within a program and allow code to be executed modularly and reused. Parameters can be passed by value or by reference. Functions can return values or not, and may or may not accept parameters. Overall, functions are a fundamental building block of C that improve code organization, reusability, and maintenance.
An array is a collection of data that holds a fixed number of values of the same type. Arrays allow storing multiple values in a single variable through indices. There are one-dimensional, two-dimensional, and multi-dimensional arrays. One-dimensional arrays use a single subscript, two-dimensional arrays use two subscripts like rows and columns, and multi-dimensional arrays can have more than two subscripts. Arrays can be initialized during declaration with values or initialized at runtime by user input or other methods. Elements are accessed using their indices and operations can be performed on the elements.
Content:
What is function pointer?
Motivation, what is the use cases of function pointer?
Declaration of function pointer in c
Initialization of function pointer in c
Calling a function using the function pointer
Example on function pointer
Function pointer as arguments
By:
AbuBakr Mohammed Ramadan
#AbuBakrMR
A function is a block of code that performs a specific task. Functions allow for modularity and code reuse in a program. There are several key aspects of functions:
1. Functions are defined with a return type, name, and parameters. The general format is return_type function_name(parameter list).
2. Parameters allow functions to accept input from the caller. There are two ways parameters can be passed: call by value or call by reference.
3. Variables declared inside a function are local, while those declared outside are global and visible to all code. Local variables exist only during the function's execution.
4. Functions can call themselves recursively to repeat a task, with a base
Recursion in c++.
The document discusses recursion, which is a programming technique where a function calls itself. It provides examples of using recursion to calculate the factorial of a number and to generate the Fibonacci series. Specifically, it shows a recursive function that calls itself with decreasing arguments to repeatedly multiply numbers to calculate a factorial, and another recursive function that calls itself twice, each time with decreasing arguments, to add the previous two values in the Fibonacci series.
The document discusses looping statements in C. It explains that loops allow code to be repeated without having to rewrite the code multiple times. It describes three types of loops: while, do-while, and for. It provides the syntax and an example for each loop type. It also discusses the break and continue statements that can be used within loops to terminate the loop early or skip iterations.
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
A pointer is a variable that stores the memory address of another variable. Pointers allow functions to modify variables in the caller and are useful for handling arrays and dynamic memory allocation. Pointers contain the address of the memory location they point to. Pointer variables can be declared to hold these memory addresses and can then be used to indirectly access the value at the addressed location.
The document discusses call by value and call by reference in functions. Call by value passes the actual value of an argument to the formal parameter, so any changes made to the formal parameter do not affect the actual argument. Call by reference passes the address of the actual argument, so changes to the formal parameter do directly modify the actual argument. An example program demonstrates call by value, where changing the formal parameter does not change the original variable.
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Functions tutorial covers all the important aspects of functions in Python right from the introduction to what functions are, all the way till checking out the major functions and using the code-first approach to understand them better.
Agenda
Why use Functions?
What are the Functions?
Types of Python Functions
Built-in Functions in Python
User-defined Functions in Python
Python Lambda Function
Conclusion
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The document discusses various C++ data types including built-in, derived, and user-defined data types. It describes the different built-in data types like int, char, float, double, void and their properties. It also discusses derived data types like arrays, functions, pointers, references, and constant. The document further explains user-defined data types like structures, unions and classes/objects in C++.
Operator overloading allows user-defined types in C++ to behave similarly to built-in types when operators are used on them. It allows operators to have special meanings depending on the context. Some key points made in the document include:
- Operator overloading enhances the extensibility of C++ by allowing user-defined types to work with operators like addition, subtraction, etc.
- Common operators that can be overloaded include arithmetic operators, increment/decrement, input/output, function call, and subscript operators.
- To overload an operator, a member or friend function is declared with the same name as the operator being overloaded. This function performs the desired operation on the class type.
-
Recursion vs. Iteration: Code Efficiency & Structurecogaxor346
This presentation delves into the Recursion vs. Iteration debate, highlighting their operational disparities. Recursion, though elegant, demands caution to prevent system crashes due to infinite loops. While it offers compact code, it suffers from slower execution and increased memory usage. Conversely, iteration, driven by repetition structures, boasts faster performance and lesser memory consumption. Examples illustrate the essence and application of recursion, emphasizing the need for terminating conditions. Additionally, the presentation touches upon modular programming principles and introduces lambda functions and the pass statement, elucidating their roles in code structure and execution control.
This document discusses functions in C programming. It begins by explaining why programs should be divided into smaller subprograms or functions for manageability. There are two types of functions: library functions which are pre-defined and cannot be modified, and user-defined functions which are created by the user. Every C program must contain a main() function. Functions allow code reusability and modularity. Parameters are used to pass data between functions. The return statement returns data from a function. Local variables are only accessible within their own function.
This document discusses string library functions in C programming. It defines what strings are as null-terminated arrays of characters. It then lists and describes common string functions - strlen() returns the length of a string, strcmp() compares two strings, strcpy() copies one string to another, and strcat() concatenates two strings. Examples are provided for each function.
The document discusses functions in C programming. It defines a function as a self-contained block of code that performs a specific task. Functions make code more modular and reusable. There are two types of functions: standard/library functions and user-defined functions. Functions can take input parameters and return values. Functions are an essential part of program structure in C as they help organize code and logic.
Constructor is a special member function that initializes objects of a class. Constructors have the same name as the class and do not have a return type. There are two types of constructors: default constructors that take no parameters, and parameterized constructors that allow passing arguments when creating objects. Constructors are automatically called when objects are created to initialize member variables, unlike regular member functions which must be explicitly called.
The document discusses C functions, including their definition, types, uses, and implementation. It notes that C functions allow large programs to be broken down into smaller, reusable blocks of code. There are two types of functions - library functions and user-defined functions. Functions are declared with a return type, name, and parameters. They are defined with a body of code between curly braces. Functions can be called within a program and allow code to be executed modularly and reused. Parameters can be passed by value or by reference. Functions can return values or not, and may or may not accept parameters. Overall, functions are a fundamental building block of C that improve code organization, reusability, and maintenance.
An array is a collection of data that holds a fixed number of values of the same type. Arrays allow storing multiple values in a single variable through indices. There are one-dimensional, two-dimensional, and multi-dimensional arrays. One-dimensional arrays use a single subscript, two-dimensional arrays use two subscripts like rows and columns, and multi-dimensional arrays can have more than two subscripts. Arrays can be initialized during declaration with values or initialized at runtime by user input or other methods. Elements are accessed using their indices and operations can be performed on the elements.
Content:
What is function pointer?
Motivation, what is the use cases of function pointer?
Declaration of function pointer in c
Initialization of function pointer in c
Calling a function using the function pointer
Example on function pointer
Function pointer as arguments
By:
AbuBakr Mohammed Ramadan
#AbuBakrMR
A function is a block of code that performs a specific task. Functions allow for modularity and code reuse in a program. There are several key aspects of functions:
1. Functions are defined with a return type, name, and parameters. The general format is return_type function_name(parameter list).
2. Parameters allow functions to accept input from the caller. There are two ways parameters can be passed: call by value or call by reference.
3. Variables declared inside a function are local, while those declared outside are global and visible to all code. Local variables exist only during the function's execution.
4. Functions can call themselves recursively to repeat a task, with a base
Recursion in c++.
The document discusses recursion, which is a programming technique where a function calls itself. It provides examples of using recursion to calculate the factorial of a number and to generate the Fibonacci series. Specifically, it shows a recursive function that calls itself with decreasing arguments to repeatedly multiply numbers to calculate a factorial, and another recursive function that calls itself twice, each time with decreasing arguments, to add the previous two values in the Fibonacci series.
The document discusses looping statements in C. It explains that loops allow code to be repeated without having to rewrite the code multiple times. It describes three types of loops: while, do-while, and for. It provides the syntax and an example for each loop type. It also discusses the break and continue statements that can be used within loops to terminate the loop early or skip iterations.
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
A pointer is a variable that stores the memory address of another variable. Pointers allow functions to modify variables in the caller and are useful for handling arrays and dynamic memory allocation. Pointers contain the address of the memory location they point to. Pointer variables can be declared to hold these memory addresses and can then be used to indirectly access the value at the addressed location.
The document discusses call by value and call by reference in functions. Call by value passes the actual value of an argument to the formal parameter, so any changes made to the formal parameter do not affect the actual argument. Call by reference passes the address of the actual argument, so changes to the formal parameter do directly modify the actual argument. An example program demonstrates call by value, where changing the formal parameter does not change the original variable.
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Functions tutorial covers all the important aspects of functions in Python right from the introduction to what functions are, all the way till checking out the major functions and using the code-first approach to understand them better.
Agenda
Why use Functions?
What are the Functions?
Types of Python Functions
Built-in Functions in Python
User-defined Functions in Python
Python Lambda Function
Conclusion
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
The document discusses various C++ data types including built-in, derived, and user-defined data types. It describes the different built-in data types like int, char, float, double, void and their properties. It also discusses derived data types like arrays, functions, pointers, references, and constant. The document further explains user-defined data types like structures, unions and classes/objects in C++.
Operator overloading allows user-defined types in C++ to behave similarly to built-in types when operators are used on them. It allows operators to have special meanings depending on the context. Some key points made in the document include:
- Operator overloading enhances the extensibility of C++ by allowing user-defined types to work with operators like addition, subtraction, etc.
- Common operators that can be overloaded include arithmetic operators, increment/decrement, input/output, function call, and subscript operators.
- To overload an operator, a member or friend function is declared with the same name as the operator being overloaded. This function performs the desired operation on the class type.
-
Recursion vs. Iteration: Code Efficiency & Structurecogaxor346
This presentation delves into the Recursion vs. Iteration debate, highlighting their operational disparities. Recursion, though elegant, demands caution to prevent system crashes due to infinite loops. While it offers compact code, it suffers from slower execution and increased memory usage. Conversely, iteration, driven by repetition structures, boasts faster performance and lesser memory consumption. Examples illustrate the essence and application of recursion, emphasizing the need for terminating conditions. Additionally, the presentation touches upon modular programming principles and introduces lambda functions and the pass statement, elucidating their roles in code structure and execution control.
This document discusses functions in C programming. It begins by explaining why programs should be divided into smaller subprograms or functions for manageability. There are two types of functions: library functions which are pre-defined and cannot be modified, and user-defined functions which are created by the user. Every C program must contain a main() function. Functions allow code reusability and modularity. Parameters are used to pass data between functions. The return statement returns data from a function. Local variables are only accessible within their own function.
The “&” indicates a parameter that is a reference variable. Because it is the value that is passed. We can always pass a literal or even an expression in call-by-value computer notes
The document provides an overview of functions in C++. It discusses the basic concepts of functions including declaring, defining, and calling functions. It covers function components like parameters and arguments. It explains passing parameters by value and reference. It also discusses different types of functions like built-in functions, user-defined functions, and functions with default arguments. Additionally, it covers concepts like scope of variables, return statement, recursion, and automatic vs static variables. The document is intended to teach the fundamentals of functions as building blocks of C++ programs.
The document provides an overview of functions in C++. It discusses the basic concepts of functions including declaring, defining, and calling functions. It covers different types of functions such as built-in functions, user-defined functions, and functions that return values. The key components of a function like the prototype, definition, parameters, arguments, and return statement are explained. It also describes different ways of passing parameters to functions, including call by value and call by reference. Functions allow breaking down programs into smaller, reusable components, making the code more readable, maintainable and reducing errors.
Functions allow programmers to structure code into modular, reusable units. A function contains a block of code that is executed when the function is called. Functions take parameters as input and can return a value. The example function "addition" takes two integer parameters, adds them together, and returns the result. The main function calls addition, passing it the values 5 and 3, and stores the returned value 8 in the variable z. Functions help avoid duplicating code and make programs easier to design, understand, and maintain.
This document provides information about functions in C programming. It defines a function as a block of code that performs a specific task and can be reused. The general form of a function definition includes the return type, function name, parameters, and function body. Functions allow breaking a large, complex program into smaller, modular sub-programs. Parameters are used to pass values between the calling function and the called function. Variables have local scope and are only accessible within the function they are defined, so parameters must be explicitly passed between functions. Functions can return values to the calling function using the return statement.
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition.docxvrickens
JLK Chapter 5 – Methods and ModularityDRAFT January 2015 Edition pg. 25
An Introduction to
Computer Science with Java, Python and C++
Community College of Philadelphia edition
Copyright 2017 by C.W. Herbert, all rights reserved.
Last edited October 8, 28, 2019 by C. W. Herbert
This document is a draft of a chapter from An Introduction to Computer Science with Java, Python and C++, written by Charles Herbert. It is available free of charge for students in Computer Science courses at Community College of Philadelphia during the Fall 2019 semester. It may not be reproduced or distributed for any other purposes without proper prior permission.
Please report any typos, other errors, or suggestions for improving the text to [email protected]
Chapter 5 – Python Functions and Modular Programming
Contents
Lesson 5.1User Created Functions in Python2
Python Function Parameters2
Value returning functions3
Example – Methods and Parameter Passing5
9
Lesson 5.2Top-Down Design and Modular Development10
Chapter Exercises13
User Created Functions in Python
So far we have only created software with one continuous Python script. We have used functions from other python modules, such as the square root method from the math class math.sqrt(n). Now we will begin to create our own functions of our own.
A Python function is a block of code that can be used to perform a specific task within a larger computer program. It can be called as needed from other Python software. Most programming languages have similar features, such as methods in Java or subroutines in system software.
The code for user-defined functions in Python is contained in a function definition. A Python function definition is a software unit with a header and a block of Python statements. The header starts with the keyword def followed by the name of the function, then a set parenthesis with any parameters for the function. A colon is used after the parentheses to indicate a block of code follows, just as with the if and while statements. The block of code to be included within the function is indented.
Here is an example of a Python function:
# firstFunction.py
# first demonstration of the use of a function for CSCI 111
# last edited 10/08/2o19 by C. Herbert
function
definition
def myFunction():
print ( "This line being printed by the function MyFunction.\n")
# end myFunction()
### main program ###
function used by the main part of the script
print("Beginning\n")
myFunction()
print("End\n")
# end main program
Functions can used for code that will be repeated within a program, or for modular development, in which long programs are broken into parts and the parts are developed independently. The parts can be developed as Python functions, then integrated to work together by being called from other software.
Python Function Parameters
Data can be passed to a Python function as a parameter of the function. Function parameters are variables listed in parentheses foll ...
This document summarizes key aspects of reference variables in C++. It discusses how reference variables are declared using an ampersand (&) symbol and how they differ from regular variables and pointer variables. It provides an example comparing three functions - one that passes a regular variable, one that passes a pointer, and one that passes a reference. When the reference variable function is called, the reference acts like an alias to the original variable, so changes made to the reference inside the function also change the original variable. This allows passing large objects to functions without incurring copying overhead.
The document discusses various control flow statements in C programming such as decision control statements (if, if-else, switch-case), looping statements (for, while, do-while loops), break, continue, goto, and functions. It provides examples of using each statement type and explains their syntax and usage. Key aspects like scope of variables, parameter passing methods (call by value, call by reference), and storage classes (auto, static, extern) related to functions are also covered in the document.
The document provides an introduction to object-oriented programming concepts in C++ including objects, classes, data abstraction, encapsulation, inheritance, polymorphism, dynamic binding, and message passing. It then describes the structure of a C++ program including include files, class definitions, data declarations, member functions, and main functions. Finally, it discusses control structures in C++ including decision making statements like if/else and switch statements, looping statements like while, do-while and for loops, and functions.
1. A function is a block of code that performs a specific task. Functions allow programmers to split a large program into smaller sub-tasks and call them multiple times.
2. There are two main types of functions - library functions provided by the standard library, and user-defined functions created by the programmer.
3. Functions make programs easier to write, read, update and debug by splitting them into smaller, well-defined tasks.
Iterators in Python allow iteration over iterable objects like lists, tuples, dicts and sets. An iterator is initialized using the iter() method and iterates using the next() method. For loops internally use iter() and next() to iterate. Custom iterators can also be defined by implementing the __iter__() and __next__() methods. Some key differences between recursion and iteration are that recursion involves function calls while iteration uses loops, and recursion has greater overhead. Common algorithms like factorial, Fibonacci sequence and Tower of Hanoi can be implemented using both recursion and iteration.
The document discusses functions in C programming. It defines functions and explains their various parts like declaration, definition, and invocation. It also differentiates between function declaration and definition. Various types of functions are classified based on their inputs and outputs. The key differences between call by value and call by reference are explained with examples. Advantages of pass by reference are also mentioned.
Complete Information till 2D arrays. In this slides you can also find information about loops and control decision....
Best slides for beginners who wants to learn about C programming language..
Slides for Lecture 1 of the course: Introduction to Programming with Python offered at ICCBS.
It covers the following topics:
1.) Variables, Statements and Expressions
2.) Functions
3.) Flow Control
This document outlines the chapters and key concepts covered in a networking course, including WAN technologies, serial communication, Frame Relay, network security, access control lists, VPN, DHCP, NAT, IPv6, and troubleshooting methodologies. Specific topics that will be covered include the hierarchical network design model, WAN connection options, HDLC encapsulation, PPP concepts, Frame Relay virtual circuits and encapsulation, network attacks and security configurations, ACL types and guidelines, teleworkers and broadband services, DHCP and relay, how NAT works, and troubleshooting tools and all network layers.
This document provides a summary of serial and parallel connections, as well as protocols used for wide area networks (WANs) such as HDLC, PPP, and others. It discusses how serial connections transmit data one bit at a time over one wire, while parallel connections transmit multiple bits simultaneously over multiple wires. It also covers concepts such as clock skew, interference, and WAN encapsulation protocols including HDLC, PPP, Frame Relay, and ATM.
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
The document discusses using a multimap in C++ to represent the relationship between a "pretty gal" and a "gentle guy". It maps the gal's "dazzling smile" to the guy "in love" using pairs and the multimap. It inserts this pair into the multimap and then searches by the gal's smile to output that the guy is for the gal's smile. The document suggests this represents the bond between a loving couple completed by each other in the multimap.
A few Programs, that are tested with compilers of respective IDEs s Bloodshed-DevC++, Visual Studio 2008, Qt 4.2. These are running successfully within console window of windows platform. So just enjoy coding. Programs in C of College days.
The document discusses the GNU Compiler Collection (GCC). GCC is a compiler system that includes front-end compilers for many programming languages like C, C++, Java, Ada, and others. It consists of three main components - a front-end that parses source code and generates an abstract syntax tree, a middle-end that performs analysis and optimizations, and a back-end that generates assembly code for specific CPU architectures. The document provides details on each of these components and how they work together to compile source code into executable binaries using GCC.
A quick review of the fundamental concepts of Copy Constructor and Assignment Operator in programming language C++ in prospective view of daily day to day life.
The document discusses the "diamond problem" that can occur with multiple inheritance in C++. Specifically, it presents a code example where a class inherits from two parent classes that both inherit from a common grandparent class. This creates ambiguous situations when calling methods from the grandparent class, since there are now two inherited implementation paths. The document explains that adding the "virtual" keyword when inheriting from the parent classes solves this problem by ensuring there is only one instance of the grandparent class.
This document discusses the diamond problem that can occur with multiple inheritance in C++. When a class inherits from two parent classes that both inherit from the same grandparent class, it can cause ambiguities when calling methods from the grandparent class. To resolve this, the inheritance relationships must be specified as virtual to ensure there is only one instance of the grandparent class in the inheritance hierarchy.
How to manage Multiple Warehouses for multiple floors in odoo point of saleCeline George
The need for multiple warehouses and effective inventory management is crucial for companies aiming to optimize their operations, enhance customer satisfaction, and maintain a competitive edge.
The Pala kings were people-protectors. In fact, Gopal was elected to the throne only to end Matsya Nyaya. Bhagalpur Abhiledh states that Dharmapala imposed only fair taxes on the people. Rampala abolished the unjust taxes imposed by Bhima. The Pala rulers were lovers of learning. Vikramshila University was established by Dharmapala. He opened 50 other learning centers. A famous Buddhist scholar named Haribhadra was to be present in his court. Devpala appointed another Buddhist scholar named Veerdeva as the vice president of Nalanda Vihar. Among other scholars of this period, Sandhyakar Nandi, Chakrapani Dutta and Vajradatta are especially famous. Sandhyakar Nandi wrote the famous poem of this period 'Ramcharit'.
Exploring Substances:
Acidic, Basic, and
Neutral
Welcome to the fascinating world of acids and bases! Join siblings Ashwin and
Keerthi as they explore the colorful world of substances at their school's
National Science Day fair. Their adventure begins with a mysterious white paper
that reveals hidden messages when sprayed with a special liquid.
In this presentation, we'll discover how different substances can be classified as
acidic, basic, or neutral. We'll explore natural indicators like litmus, red rose
extract, and turmeric that help us identify these substances through color
changes. We'll also learn about neutralization reactions and their applications in
our daily lives.
by sandeep swamy
Multi-currency in odoo accounting and Update exchange rates automatically in ...Celine George
Most business transactions use the currencies of several countries for financial operations. For global transactions, multi-currency management is essential for enabling international trade.
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsDrNidhiAgarwal
Unemployment is a major social problem, by which not only rural population have suffered but also urban population are suffered while they are literate having good qualification.The evil consequences like poverty, frustration, revolution
result in crimes and social disorganization. Therefore, it is
necessary that all efforts be made to have maximum.
employment facilities. The Government of India has already
announced that the question of payment of unemployment
allowance cannot be considered in India
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsesushreesangita003
what is pulse ?
Purpose
physiology and Regulation of pulse
Characteristics of pulse
factors affecting pulse
Sites of pulse
Alteration of pulse
for BSC Nursing 1st semester
for Gnm Nursing 1st year
Students .
vitalsign
GDGLSPGCOER - Git and GitHub Workshop.pptxazeenhodekar
This presentation covers the fundamentals of Git and version control in a practical, beginner-friendly way. Learn key commands, the Git data model, commit workflows, and how to collaborate effectively using Git — all explained with visuals, examples, and relatable humor.
How to Manage Opening & Closing Controls in Odoo 17 POSCeline George
In Odoo 17 Point of Sale, the opening and closing controls are key for cash management. At the start of a shift, cashiers log in and enter the starting cash amount, marking the beginning of financial tracking. Throughout the shift, every transaction is recorded, creating an audit trail.
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetSritoma Majumder
Introduction
All the materials around us are made up of elements. These elements can be broadly divided into two major groups:
Metals
Non-Metals
Each group has its own unique physical and chemical properties. Let's understand them one by one.
Physical Properties
1. Appearance
Metals: Shiny (lustrous). Example: gold, silver, copper.
Non-metals: Dull appearance (except iodine, which is shiny).
2. Hardness
Metals: Generally hard. Example: iron.
Non-metals: Usually soft (except diamond, a form of carbon, which is very hard).
3. State
Metals: Mostly solids at room temperature (except mercury, which is a liquid).
Non-metals: Can be solids, liquids, or gases. Example: oxygen (gas), bromine (liquid), sulphur (solid).
4. Malleability
Metals: Can be hammered into thin sheets (malleable).
Non-metals: Not malleable. They break when hammered (brittle).
5. Ductility
Metals: Can be drawn into wires (ductile).
Non-metals: Not ductile.
6. Conductivity
Metals: Good conductors of heat and electricity.
Non-metals: Poor conductors (except graphite, which is a good conductor).
7. Sonorous Nature
Metals: Produce a ringing sound when struck.
Non-metals: Do not produce sound.
Chemical Properties
1. Reaction with Oxygen
Metals react with oxygen to form metal oxides.
These metal oxides are usually basic.
Non-metals react with oxygen to form non-metallic oxides.
These oxides are usually acidic.
2. Reaction with Water
Metals:
Some react vigorously (e.g., sodium).
Some react slowly (e.g., iron).
Some do not react at all (e.g., gold, silver).
Non-metals: Generally do not react with water.
3. Reaction with Acids
Metals react with acids to produce salt and hydrogen gas.
Non-metals: Do not react with acids.
4. Reaction with Bases
Some non-metals react with bases to form salts, but this is rare.
Metals generally do not react with bases directly (except amphoteric metals like aluminum and zinc).
Displacement Reaction
More reactive metals can displace less reactive metals from their salt solutions.
Uses of Metals
Iron: Making machines, tools, and buildings.
Aluminum: Used in aircraft, utensils.
Copper: Electrical wires.
Gold and Silver: Jewelry.
Zinc: Coating iron to prevent rusting (galvanization).
Uses of Non-Metals
Oxygen: Breathing.
Nitrogen: Fertilizers.
Chlorine: Water purification.
Carbon: Fuel (coal), steel-making (coke).
Iodine: Medicines.
Alloys
An alloy is a mixture of metals or a metal with a non-metal.
Alloys have improved properties like strength, resistance to rusting.
Geography Sem II Unit 1C Correlation of Geography with other school subjectsProfDrShaikhImran
The correlation of school subjects refers to the interconnectedness and mutual reinforcement between different academic disciplines. This concept highlights how knowledge and skills in one subject can support, enhance, or overlap with learning in another. Recognizing these correlations helps in creating a more holistic and meaningful educational experience.
This chapter provides an in-depth overview of the viscosity of macromolecules, an essential concept in biophysics and medical sciences, especially in understanding fluid behavior like blood flow in the human body.
Key concepts covered include:
✅ Definition and Types of Viscosity: Dynamic vs. Kinematic viscosity, cohesion, and adhesion.
⚙️ Methods of Measuring Viscosity:
Rotary Viscometer
Vibrational Viscometer
Falling Object Method
Capillary Viscometer
🌡️ Factors Affecting Viscosity: Temperature, composition, flow rate.
🩺 Clinical Relevance: Impact of blood viscosity in cardiovascular health.
🌊 Fluid Dynamics: Laminar vs. turbulent flow, Reynolds number.
🔬 Extension Techniques:
Chromatography (adsorption, partition, TLC, etc.)
Electrophoresis (protein/DNA separation)
Sedimentation and Centrifugation methods.
1. Fundamentals Of Programming in C
Presented By:
saket kr Pathak
M.sc. nt & M
aMIty InstItute Of InfOrMatIOn
technOlOgy
1
2. Recursion
Recursion is said as a mathematical concept which states that an
expression such that each term is generated by repeating a particular
mathematical operation. Here repeating is the iterative manner to
perform same operation.
As the approach of the programming language C, it can be performed
and are in practice within the definition part of functions. Syntactically
language provides the freedom to call function within it’s body
defined.
Definition of ‘Recursion’ as the logical prospective view states simply
the iterative manner to perform any code snippet in C, but we always
need a terminating condition to control the going on iterations. In the
following sections we will discuss the iterative manner of recursion
and the terminating condition in bit expanded form.
Fundamentals Of Programming in C 2
3. Recursive Functions
Recursive functions are not different from the syntactical structure of
the general functions that we had discussed in previous sections.
They have same return type, function name, parameters enclosed
within parenthesis.
Declaration:
int Think_and_ Play (int, char);
We had discussed the syntactical view of the function, where return
type is ‘int’, function name is ‘Think_and_Play’ and within the
parenthesis we had defined the parameters as of data type integer
with another one that is of data type character.
Amity Institute Of Information Technology 3
4. Now let us manipulate the definition of the our function, that we had
declared in the previous slide from the general aspect of definition
we had practiced till now.
Definition:
int _iFlag =0, _iTerminate = 0;
int Think_and_Play(int _iBat, char _chBall)
{
if (_iFlag ==0)
printf(“This is game cricket going on.”);
_iFlag++;
if(_iTerminate < 6)
{
printf(“Hit the Ball with the Bat.”);
++ _iTerminate;
Think_and_Play(1, ‘0’);
return 1;
}
}
Amity Institute Of Information Technology 4
5. As in sequence of explanation, this snippet code has few syntactical
statements. In the very first the program counter encounters with the
Variables of type integer that are global to the function.
Then it encounters the return type of the function following with the
function name, and the parameters defined. All of these has the
considerable part in function definition structure of C language that
we had discussed in the previous sections of declaration.
As encounter with the right curly braces comes into just next
statement, it considers the following structure is for definition.
In the definition part, the first if condition is doing its formal
responsibility to control the execution of print function where the
defined condition will be true i.e. when the value of the variable
‘_iFlag’ is strictly equal to 0.
Amity Institute Of Information Technology 5
6. The next statement is simply incrementing the value stored in the
memory location termed as ‘_iFlag’ (the variable name).
Then our point of consideration comes into picture in the execution
of second ‘if’ structure. Here in this ‘if’ structure program counter
will execute the statements defined within ‘if’ body, if and only if
the condition gets true. It means whenever the condition defined
with the if statements returns ‘Boolean True’ value then the further
body will execute. So we can consider the controlling system of the
execution of ‘if-body’ is properly controlled through the condition
defined there in if statement.
Now within the body concerned, we have a print function that
supports its definition with two arguments defined as ‘String type’
and another is ‘Variable Length Argument’ (i.e. null in the snippet).
Function performs the role successfully and control passes further.
Amity Institute Of Information Technology 6
7. The followed statement says to increment the value stored in the
memory location corresponds to the variable name ‘_iTerminate’.
Here logically this increasing value of ‘_iTerminate’ and the if
condition defined above will cause the terminating condition.
At the near end of the body, we have a function call as
‘Think_and_Play(…, …)’. Since here we are calling the same
function that is executing, is said as recursion. Therefore, calling of
the function from its own body forms a loop like execution pattern
and is said as recursion. It is also considered as the alternative
programming pattern of looping structure (i.e. of ‘for loop’ and
‘while loop’).
The end statement says to return the value to the calling function as
‘return 1’, that declares the successful completion of all other
statements defined above.
Amity Institute Of Information Technology 7
8. Discussion
Typically, recursion is quite elegant and requires fewer variables to
make the same calculation as iterative looping structural programs.
It take care of its assigned records by maintaining the stack of
arguments and variables for each invocation. It has been calculated
in some machines a simple recursive program call with snippet
defining one integer argument can be requires 8 32-bit words on the
stack.
Let us consider a snippet code of fibonacci sequence and calculate
it’s efficiency in the following section.
Amity Institute Of Information Technology 8
9. Snippet-Code:
int fibonacci (int _iNam)
{
if (_iNam <= 1)
return _iNam;
else
return (fibonacci(_iNam-1)+fibonacci(_iNam-2)) }
Through ‘main()’ call the ‘fibonacci()’ with the index value to next generate
recursive value.
Amity Institute Of Information Technology 9
10. Dissection of ‘fibonacci’ Program:
int fibonacci (int _iNam)
Here in the above statement the function name ‘fibonacci’
has the parameter type defined as ‘integer’ having the return type as
‘integrer’. The right braces comes as the starting point of the snippet
code.
if (_iNam <= 1)
return _iNam;
Here in the above two statements the condition followed by
‘if’, is establised as the terminating point if condition gets it
satisfied. On the satisfactory mode of ‘if’ statement the value
stored in _iNam return back to the calling.
Amity Institute Of Information Technology 10
11. else
return (fibonacci(_iNam -1) + fibonacci(_iNam - 2));
In the else part of the consecutive ‘if’ statement the return value
is a bit complex. At first the recursion takes place for the first part
from left and returns 1 decremented value i.e. ‘-1’ to the previous
value, simultaneously it maintains a stack of all the new variables
and concern values for each invocation. That will be come in use
for the next recursive call. The next recursive call initializes the
variable with the decremented value as ‘-2’. At the end when
function call completes then the respective sum of the value
returns back to the calling statement in ‘main()’.
The left braces shows the termination of the code snippet.
Amity Institute Of Information Technology 11
12. As in the following we have the table showing 10 number of
function calls in simultaneous recursion.
Value of _iNam Return Value of Number of Function calls in recursive
fibonacci(_iNam) computation.
0 0 1
1 1 1
2 1 3
3 2 5
4 3 9
5 5 15
6 8 25
7 13 41
8 21 67
Amity Institute Of Information Technology 12
13. As in the above table describes, the value passed through the
parameter, the value that the function returns and the number of
recursive steps a function can perform up to 9 sequential calls.
Cons:
Recursive programs typically use a large amount of computer
memory and the greater the recursion, the more memory used.
Recursive programs can be confusing to develop and
extremely complicated to debug.
Pros:
Recursion is a natural fit for some types of problems as
‘Tower of Hanoi’.
Amity Institute Of Information Technology 13
14. Practice ‘Towers of Hanoi’
Problem:
The Classical Towers of Hanoi - an initial position of all disks is on
post 'A‘.
Amity Institute Of Information Technology 14
15. The target solution of the puzzle is to build the tower on post 'C'.
The number of discs can vary, but there are only three towers.
The goal is to transfer the discs from one tower another tower.
However you can move only one disk at a time and you can never
place a bigger disc over a smaller disk.
Amity Institute Of Information Technology 15
16. Algorithm to solve the above problem:
Move the top 3 disks from Source to Auxiliary tower,
Move the 4th disk from Source to Destination tower,
Move the 3 disks from Auxiliary tower to Destination tower.
Transfer the top 3 disks from Source to Auxiliary tower can again
be thought as a fresh problem and can be solve in the same manner.
Amity Institute Of Information Technology 16
17. Let us do it step by step:
At first move the ‘Disc1’ to ‘B’ and ‘Disc2’ to ‘C’ as in
following figure:
Amity Institute Of Information Technology 17
18. Move the ‘Disc1’ to the top of the ‘Disc2’ at ‘C’ and ‘Disc3’ at
‘B’.
Move the ‘Disc1’ to ‘A’ at the top of ‘Disc4’ and ‘Disc2’ at ‘B’ to the top
of ‘Disc3’.
Amity Institute Of Information Technology 18
19. Move the ‘Disc1’ at ‘B’ to the top of ‘Disc2’ and ‘Disc4’ at ‘A’.
Move the ‘Disc1’ at ‘C’ to the top of ‘Disc4’ and ‘Disc2’ at ‘A’.
Amity Institute Of Information Technology 19
20. Move the ‘Disc1’ at ‘A’ to the top of ‘Disc2’ and ‘Disc3’ to the top of
‘disc4’ at ‘A’.
Move the ‘Disc1’ at ‘B’ and ‘Disc2’ at ‘B’ to the top of ‘Disc3’.
Amity Institute Of Information Technology 20
21. Move the ‘Disc1’ at the top of ‘Disc2’ at ‘C’.
Congratulations you got your answer. Code implementation is up to
you people as hint use the concept of stack and just follow the steps
Above described.
Amity Institute Of Information Technology 21
22. /
***********************************************************//
/Here in the following Program, towers are considered as character A, B
//and C and disks are considered as integral numbers.
/***********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
Amity Institute Of Information
Technology 22
23. void generate_moves_toh(int i_disk_num, char from_peg,
char to_peg, char aux_peg)
{
/* If only 1 disk, make the move and return */
if(i_disk_num == 1)
{
printf("nMove disk 1 from peg %c to peg
%c", from_peg, to_peg);
return;
}
Amity Institute Of Information
Technology 23
24. /*Move top n-1 disks from A to B, using C as auxiliary
*/
generate_moves_toh(i_disk_num-1, from_peg,
aux_peg, to_peg);
printf("nMove disk %d from peg %c to peg %c",
i_disk_num, from_peg, to_peg);
/* Move n-1 disks from B to C using A as auxiliary */
generate_moves_toh(i_disk_num-1, aux_peg, to_peg,
from_peg);
}
Amity Institute Of Information
Technology 24
25. void gen_tow_of_honoi()
{
printf("WAP to display the steps required in
solving 'Tower of Hanoi' for 'n' number of disks.");
printf("nLimitation: nt-> Disks are
represented as integral numbers in assending order.");
printf("nnn");
int i_num_disk;
printf("Enter the number of disks : ");
scanf("%d",&i_num_disk);
printf("The Tower of Hanoi involves the moves
:nn");
generate_moves_toh(i_num_disk, 'A', 'C', 'B');
}
Amity Institute Of Information
Technology 25
26. int main()
{
gen_tow_of_honoi();
printf("nnn");
getch();
return 0;
}
Amity Institute Of Information
Technology 26
27. •The C Programming Language (by Dennis M. Ritchie and Brain W.
Kernighan).
•A book on C (by Al Kelley and Ira Pohl).
•Let us C (by Yashavant Kanetkar).
Amity Institute Of Information
Technology 27