SlideShare una empresa de Scribd logo
1 de 14
Learn Function
The Hard Way
Hello!
I am Iftekhar Mohammad
Just another noob :v
and Gintama Fan :3
Function
Who works from the shadow
“
“Functions are "self contained" modules of
code that accomplish a specific task.
Functions usually "take in" data, process it,
and "return" a result. Once a function is
written, it can be used over and over and
over again. Functions can be "called" from
the inside of other functions.”
What we will do:
◎Talk about Function
◎Compare functions (in programming) with
functions (in math)
◎See some examples
◎Try to establish that definition
Function In Math….
A block of equation who..
◎ Takes value(s)
◎ Processes the
equation with that
value(s)
◎ Finds a value(s)
◎ Gives us that value(s)
Example: F(x)=2x+1
◎F(3)=2x+1
◎F(3)=2*3+1
◎F(3)=7
◎F(x)=7 (where x=3)
Function In Programming….
A block of Code who…
◎ Takes value(s)
◎ Processes the
statement(s) with
that value(s)
◎ Finds a output
◎ Returns us that
output
Example: int add(int a, int b){
int result;
result=a+b;
return result;
}
◎ add(2,3); //also can take variables
◎ result= 2+3; //in compiler this
happens
◎ result=5; //in compiler this happens
◎ return result;//returns 5
Math:
◎ There is a function f(x)//
◎ F(x)=2x+1
◎ F(3)=2x+1
◎ F(3)=2*3+1
◎ F(3)=7
◎ F(x)=7 (where x=3)
Lets see them side by side:
Programming:
◎ int add(int a, int b);
◎ int add(int a, int b){
int result;
result=a+b;
return result;
}
◎ add(2,3);
◎ result=2+3;
◎ result=5;
◎ Return result;
Math:
◎ There is a function f(x)//declaration
◎ F(x)=2x+1 //definition
◎ F(3)=2x+1//calling
◎ F(3)=2*3+1 //processing
◎ F(3)=7 //output
◎ F(x)=7 (where x=3)//return output
Lets see them side by side more deeply:
Programming:
◎ int add(int a, int b); //declaration
◎ int add(int a, int b){//definition
int result;
result=a+b;
return result;
}
◎ add(2,3); //calling
◎ result=2+3; //processing
◎ result=5; //output
◎ Return result; //return output
So……..
Both programming and
math function matches the
definition.
Functions:
1. accomplish a specific
task
2. take in data
3. process data
4. return a result
5. can be used over and
over again
6. can be called
Examples:
◎Write A function that squares the input. Like
if I give 2 it will return 4:
#include<stdio.h>
float square ( float x );
int main( )
{
float m, n ;
printf ( "Enter some number for finding square: n");
scanf ( "%f", &m ) ;
n = square ( m ) ;
printf ( “ n Square of the given number %f is %f",m,n );
}
float square ( float x ) {
float p ;
p = x * x ;
return p ;
}
Examples:
◎Write A function that divides a input with
another input. Like if I give 4 and 2 it will return 2:
#include <stdio.h>
int divide( int x, int y );
int main() {
int x, y;
printf( "Please input two numbers to be divided:");
scanf( "%d %d", &x , &y );
printf( "The Division of your two numbers is %dn", divide( x, y ) );
}
int divide(int x, int y)
{
return x / y;
}
Problems:
Try to solve the followings:
1. Write a function find the modulus of two input.
2. Write a function to solve the equation: 2x+5y-3.
3. Write a function to solve the equation: x2+2xy+y2
4. Write a function to solve the equation: x2-2xy+y2
5. Write a function to the find the distance a car will travel when
initial velocity = x ms-1, acceleration= y ms-2 and time = t second.
Thanks!
Any questions?

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
CSE240 Pointers
CSE240 PointersCSE240 Pointers
CSE240 Pointers
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Lecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C ProgrammingLecture 6- Intorduction to C Programming
Lecture 6- Intorduction to C Programming
 
Multidimensional arrays in C++
Multidimensional arrays in C++Multidimensional arrays in C++
Multidimensional arrays in C++
 
Unit2 input output
Unit2 input outputUnit2 input output
Unit2 input output
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started
 
Arrays
ArraysArrays
Arrays
 
Lecture 17 - Strings
Lecture 17 - StringsLecture 17 - Strings
Lecture 17 - Strings
 
Chap 9(functions)
Chap 9(functions)Chap 9(functions)
Chap 9(functions)
 
Lecture 7- Operators and Expressions
Lecture 7- Operators and Expressions Lecture 7- Operators and Expressions
Lecture 7- Operators and Expressions
 
Functions (Computer programming and utilization)
Functions (Computer programming and utilization)Functions (Computer programming and utilization)
Functions (Computer programming and utilization)
 
Arrays and Pointers
Arrays and PointersArrays and Pointers
Arrays and Pointers
 
C++ lecture 03
C++   lecture 03C++   lecture 03
C++ lecture 03
 
Arrays
ArraysArrays
Arrays
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
 

Destacado

Atmospheric Pressure Chemical Ionization
Atmospheric Pressure Chemical IonizationAtmospheric Pressure Chemical Ionization
Atmospheric Pressure Chemical IonizationVISHAL THAKUR
 
Atmospheric Pressure Ionization
Atmospheric Pressure IonizationAtmospheric Pressure Ionization
Atmospheric Pressure IonizationVinitha Nair
 
Chemical ionization
Chemical ionizationChemical ionization
Chemical ionizationAarif Khan
 
Lcms gcms and its applications
Lcms gcms and its applicationsLcms gcms and its applications
Lcms gcms and its applicationsNihal Calicut
 
Chromatography lc ms
Chromatography lc msChromatography lc ms
Chromatography lc msmohammed rida
 
Ionizaion Techniques - Mass Spectroscopy
Ionizaion Techniques - Mass SpectroscopyIonizaion Techniques - Mass Spectroscopy
Ionizaion Techniques - Mass SpectroscopySuraj Choudhary
 
Radiation detectors
Radiation detectorsRadiation detectors
Radiation detectorsjmocherman
 
Ionization chamber
Ionization chamberIonization chamber
Ionization chamberAnas Yess
 
Liquid chromatography and mass spectrometry.(LCMS)
Liquid chromatography and mass spectrometry.(LCMS)Liquid chromatography and mass spectrometry.(LCMS)
Liquid chromatography and mass spectrometry.(LCMS)Saptarshi Das
 
Mass spectrometry(Ionization Techniques) by Ashutosh Panke
Mass spectrometry(Ionization Techniques) by Ashutosh PankeMass spectrometry(Ionization Techniques) by Ashutosh Panke
Mass spectrometry(Ionization Techniques) by Ashutosh PankeAshutosh Panke
 
Mass spectrometry basic principles
Mass spectrometry basic principlesMass spectrometry basic principles
Mass spectrometry basic principlesRania Elsharkawy
 

Destacado (13)

Atmospheric Pressure Chemical Ionization
Atmospheric Pressure Chemical IonizationAtmospheric Pressure Chemical Ionization
Atmospheric Pressure Chemical Ionization
 
Atmospheric Pressure Ionization
Atmospheric Pressure IonizationAtmospheric Pressure Ionization
Atmospheric Pressure Ionization
 
Chemical ionization
Chemical ionizationChemical ionization
Chemical ionization
 
Lcms gcms and its applications
Lcms gcms and its applicationsLcms gcms and its applications
Lcms gcms and its applications
 
Chromatography lc ms
Chromatography lc msChromatography lc ms
Chromatography lc ms
 
Ionizaion Techniques - Mass Spectroscopy
Ionizaion Techniques - Mass SpectroscopyIonizaion Techniques - Mass Spectroscopy
Ionizaion Techniques - Mass Spectroscopy
 
Radiation detectors
Radiation detectorsRadiation detectors
Radiation detectors
 
Ionization chamber
Ionization chamberIonization chamber
Ionization chamber
 
Liquid chromatography and mass spectrometry.(LCMS)
Liquid chromatography and mass spectrometry.(LCMS)Liquid chromatography and mass spectrometry.(LCMS)
Liquid chromatography and mass spectrometry.(LCMS)
 
Mass spectrometry(Ionization Techniques) by Ashutosh Panke
Mass spectrometry(Ionization Techniques) by Ashutosh PankeMass spectrometry(Ionization Techniques) by Ashutosh Panke
Mass spectrometry(Ionization Techniques) by Ashutosh Panke
 
Radiation detectors
Radiation detectorsRadiation detectors
Radiation detectors
 
Mass spectrometry basic principles
Mass spectrometry basic principlesMass spectrometry basic principles
Mass spectrometry basic principles
 
Mass spectrometry
Mass spectrometryMass spectrometry
Mass spectrometry
 

Similar a Learn Function The Hard Way

Similar a Learn Function The Hard Way (20)

6. function
6. function6. function
6. function
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
 
Python_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptxPython_Unit-1_PPT_Data Types.pptx
Python_Unit-1_PPT_Data Types.pptx
 
C function
C functionC function
C function
 
functions
functionsfunctions
functions
 
Recursion concepts by Divya
Recursion concepts by DivyaRecursion concepts by Divya
Recursion concepts by Divya
 
CHAPTER 6
CHAPTER 6CHAPTER 6
CHAPTER 6
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
Functions
FunctionsFunctions
Functions
 
Function
FunctionFunction
Function
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1
 
Python Lecture 4
Python Lecture 4Python Lecture 4
Python Lecture 4
 
Python-review1.ppt
Python-review1.pptPython-review1.ppt
Python-review1.ppt
 
Python : Functions
Python : FunctionsPython : Functions
Python : Functions
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Unit 3 (1)
Unit 3 (1)Unit 3 (1)
Unit 3 (1)
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 

Último

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
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
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Último (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Learn Function The Hard Way

  • 2. Hello! I am Iftekhar Mohammad Just another noob :v and Gintama Fan :3
  • 4. “ “Functions are "self contained" modules of code that accomplish a specific task. Functions usually "take in" data, process it, and "return" a result. Once a function is written, it can be used over and over and over again. Functions can be "called" from the inside of other functions.”
  • 5. What we will do: ◎Talk about Function ◎Compare functions (in programming) with functions (in math) ◎See some examples ◎Try to establish that definition
  • 6. Function In Math…. A block of equation who.. ◎ Takes value(s) ◎ Processes the equation with that value(s) ◎ Finds a value(s) ◎ Gives us that value(s) Example: F(x)=2x+1 ◎F(3)=2x+1 ◎F(3)=2*3+1 ◎F(3)=7 ◎F(x)=7 (where x=3)
  • 7. Function In Programming…. A block of Code who… ◎ Takes value(s) ◎ Processes the statement(s) with that value(s) ◎ Finds a output ◎ Returns us that output Example: int add(int a, int b){ int result; result=a+b; return result; } ◎ add(2,3); //also can take variables ◎ result= 2+3; //in compiler this happens ◎ result=5; //in compiler this happens ◎ return result;//returns 5
  • 8. Math: ◎ There is a function f(x)// ◎ F(x)=2x+1 ◎ F(3)=2x+1 ◎ F(3)=2*3+1 ◎ F(3)=7 ◎ F(x)=7 (where x=3) Lets see them side by side: Programming: ◎ int add(int a, int b); ◎ int add(int a, int b){ int result; result=a+b; return result; } ◎ add(2,3); ◎ result=2+3; ◎ result=5; ◎ Return result;
  • 9. Math: ◎ There is a function f(x)//declaration ◎ F(x)=2x+1 //definition ◎ F(3)=2x+1//calling ◎ F(3)=2*3+1 //processing ◎ F(3)=7 //output ◎ F(x)=7 (where x=3)//return output Lets see them side by side more deeply: Programming: ◎ int add(int a, int b); //declaration ◎ int add(int a, int b){//definition int result; result=a+b; return result; } ◎ add(2,3); //calling ◎ result=2+3; //processing ◎ result=5; //output ◎ Return result; //return output
  • 10. So…….. Both programming and math function matches the definition. Functions: 1. accomplish a specific task 2. take in data 3. process data 4. return a result 5. can be used over and over again 6. can be called
  • 11. Examples: ◎Write A function that squares the input. Like if I give 2 it will return 4: #include<stdio.h> float square ( float x ); int main( ) { float m, n ; printf ( "Enter some number for finding square: n"); scanf ( "%f", &m ) ; n = square ( m ) ; printf ( “ n Square of the given number %f is %f",m,n ); } float square ( float x ) { float p ; p = x * x ; return p ; }
  • 12. Examples: ◎Write A function that divides a input with another input. Like if I give 4 and 2 it will return 2: #include <stdio.h> int divide( int x, int y ); int main() { int x, y; printf( "Please input two numbers to be divided:"); scanf( "%d %d", &x , &y ); printf( "The Division of your two numbers is %dn", divide( x, y ) ); } int divide(int x, int y) { return x / y; }
  • 13. Problems: Try to solve the followings: 1. Write a function find the modulus of two input. 2. Write a function to solve the equation: 2x+5y-3. 3. Write a function to solve the equation: x2+2xy+y2 4. Write a function to solve the equation: x2-2xy+y2 5. Write a function to the find the distance a car will travel when initial velocity = x ms-1, acceleration= y ms-2 and time = t second.