SlideShare uma empresa Scribd logo
1 de 52
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
1
1.Read and prepare The C.S. PPT well before
session .
2.During session Engage your team work ,
present , personalize and speak ,Use body
language , move and lead your colleges
The result is a clever , good personality and
communication skills .
Agenda of Develop programs to solve a
variety of problems in math, and games .
- Warming UP : quiz 15 min .
- PPT Revision 10 min
- PPT presentation 15 min.
- code blocks video 5 min .
- Using code blocks :- writing different programs
for math 10 min
- ways to learn programming fast video 5 min
- PPT presentation 15 min.
- Exit ticket 5 minhttp://www.stemassiut.info prepared By Mr. Osama Ghandour
2
Learning Outcome: Describe different basic
programming codes and languages.
Key Concepts: -
• Understand random number generation function.
• Understand some mathematics function like Square
root .
• If statement
• Combine conditions using logical operators (&&, ||,
and !).
• Skills: Design, thinking, analyzing and problem-solving.
• Essential Questions: How can we benefit from programming
language in solving problems in our daily life?
http://www.stemassiut.info prepared By Mr. Osama Ghandour
3
Online auto answerd quiz 15 min
http://www.stemassiut.info
prepared By ENG. Osama Ghandour
Data types in C
•Only really four basic types:
• char
• int (short, long, )
• float
• double
•Size of these types on CLEAR
machines:
•Sizes of these types vary
from one machine to another!
Type Size
(bytes)
Precision
char 1
int 2 to 4
short 2
long 4
float 4 6 decimal places
double 8 15 decimal places
Long double 10 19 decimal places
Previous
session
Press here
for on line
Press here
for off line
OR
Rules for writing variable name in C
•Variable name can be composed of letters (both
uppercase and lowercase letters), digits and
underscore '_' and Digits ( 0 – 9 ) only
•Blanks & Commas are not allowed
•No Special Symbols other than underscore(_) are
allowed
•First Character should be alphabet or Underscore
•Variable name Should not be Reserved Wordhttp://www.stemassiut.info prepared By ENG.
Osama Ghandour
6
• Constants
Constants are the terms that
can't be changed during the
execution of a program.
Its preprocessor Syntax as :
#define Pi 3.14
or as :
const float Pi=3.14 ;
• Variables
• A variable is just a named
area of storage , it is a
memory location in
computer's memory to store
data that can hold a single
value
its Syntax as :
int j=10;http://www.stemassiut.info prepared By ENG. Osama Ghandour7
Constant vs Variable
http://www.stemassiut.info prepared By ENG. Osama Ghandour
printf("%f", Y );
Previous
session
Input : In any programming language input means to feed some data
into program. This can be given in the form of file or from command
line. C programming language provides a set of built-in functions to
read given input and feed it to the program as per requirement.
scanf("%f",& X);
Y=F(x)
Output : In any programming language output means to display
some data on screen, printer or in any file. C programming
language provides a set of built-in functions to output required
data.
http://www.stemassiut.info prepared By Eng. Osama Ghandour
# include <stdio.h>
# include <math.h>
# include <stdlib.h>
/*find the Voltage Value when given the current and resistant values*/
int main()
{
float current , resistant , voltage ;
scanf("%f",&resistant);
scanf("%f",& voltage);
current = voltage / resistant;
printf("%f", ” current = ”, current );
return 0;
}
http://www.stemassiut.info prepared By ENG. Osama Ghandour
How learning happens?
I hear… I forget;
I see … I remember;
I do … I understand.
12
Code blocks , Download it , Install it , use
it by writing programs.
Then be a clever programmer.
Open
Arduino
software
In math in MA.L.O. 1.07 W 1 : 4
you learned about : • Analyze the functions
• quadratic equations , Parabola .
• complex numbers
• Trigonometric functions
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
16
In capstone you are required to
design a prototype for saving
wasted energy
o How can things be real and imaginary?
Power factor
http://www.stemassiut.info prepared By ENG.
Osama Ghandour
saving wasted energy
http://www.stemassiut.info prepared By ENG.
Osama Ghandour
Power factor
http://www.stemassiut.info
prepared By ENG. Osama Ghandour
Power factor
Pr. Home work you studied in physics about
electric power and in your capstone about saving
wasted energy so design a flowchart for Arduino
control circuit to save the consumed energy in
electric power circuit . Note : an ideal electric
system has power factor PF=0.999 and very low
reactive power.
http://www.stemassiut.info prepared By ENG. Osama Ghandour
Essential questions
-Why is modeling an
indispensable tool?
-Why do we need
laws/rules? To be used in
programming?http://www.stemassiut.info prepared By Mr. Osama
Ghandour
21
In math in MA.L.O. 1.08 Week 5 : 7
you will learn about :
In C programming you learned about
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
22
exponential and logarithmic functions
pow(num,power)
http://www.stemassiut.info prepared By Mr. Osama Ghandour
23
#include<stdio.h>
#include<math.h>
int main()
{
int num,power,result;
printf("nEnter the numaber and its Power : ");
scanf("%d%d",&num,&power);
result = pow(num,power);
printf("nResult : %d",result);
return(0);}
//Are we ready to code?
In math in MA.L.O. 1.09 Week 8 : 11
you will learn about :
In C programming you learned about
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
24
-Trigonometric functions
-sine, cosine and tangent
functions
cos (degree)
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
25
Are we ready to code?
Essential questions
•How do humans make informed
decisions, given multiple options?
•What factors affect our decisions
and how do these factors relate
to programmimg models?
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
26
In math in MA.L.O. 1.10 Week 8 : 11
you will learn about :
In C programming you learned about
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
27
Pythagorean Identities
sqrt (num);
sqrt example
#include <stdio.h>
#include <math.h>
int main () /* sqrt example */
{
double param, result;
param = 1024.0;
result = sqrt (param);
printf (“%f%fn", param , result);
return 0;
}
http://www.stemassiut.info prepared By Mr. Osama Ghandour28
//Are we ready to code?
See also
•log Compute natural logarithm
(function).
•exp compute exponent of
number (function
http://www.stemassiut.info
prepared By Mr. Osama Ghandour
29
Are we ready to code it?
Video about using code
blocks
30 http://www.stemassiut.info prepared By Mr. Osama Ghandour
Press here
for on line
Press here
for off line
OR
Essential questions
•Why use shortcuts?
•Why is it essential to have
different ways of
reaching solutions?
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
31
In math in MA.L.O. 1.12 Week 12 :
14
you will learn about :
In C programming write a program to
find the values of n unknowns when
you given a set of n equations of thesehttp://www.stemassiut.info prepared By Mr. Osama
Ghandour
32
1-Matrices 2- System
3- System of equations
In mechanics you learned
ME.L.O. 1.06 W 3:5
Lami's rule write a C program to find
unknown when given required values
ME. L.O. 1.07 W 6:8
Newton's 2nd law write a C program to find
unknown when given required values
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
33
In Physics you are learning in
PH. L.O. 1.08 W 1:3
1. Fluids , 2. Pressure , 3. Archimedes Principle
PH. L.O. 1.09 W 4:6
1. Continuity equation , 2. Work-Energy Theorem , 3.
Bernoulli Equation
PH. L.O. 1.11 W 10:12
1-1st Law of Thermodynamics
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
34
Write C programs to find automated
solutions for each of the above
equations and or laws
Home work 1 Write a cprogram for
application which uses the continuity
equation a1*v1 = a2*v2 where a and v
are area and velocity respectively .
36 http://www.stemassiut.info prepared By Mr. Osama Ghandour
Design a c program for calculating the EMF
(Electromotive force )using faraday's law of
induction equation
http://www.stemassiut.info preparedBy Mr. Osama Ghandour38
What is and where wastedenergy here ?
Are we ready to code it?
6 ways to learn
programming fast
39 http://www.stemassiut.info prepared By Mr. Osama Ghandour
Press here
for on line
Press here
for off line
OR
•If statement.
•Combine conditions
using logical
operators (&&, ||,
!).
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
40
• The conditions in if statements are built out of
relational and logical operators.
The six relational operators that C provides
for comparing numbers:
== != > < >= <=
• But suppose you need to know if the value of
the variable x is both greater than zero and
less than one? None of these relational
operators by itself can answer that question.
What you need is to combine two conditions:
• (x > 0.0) and (y < 1.0)
41
http://www.stemassiut.info prepared By Mr. Osama Ghandour
•This is what logical operators can do for you. A
logical operator combines one or two
conditions into a single new condition. C
provides three logical operators:
•``&&'' (two ampersands) means and.
•``||'' (two vertical bars) means or.
•``!'' (an exclamation point) means not.
•Let's look at an example. If you need to know if
the value of the variable x is between zero and
one, inclusive, you would write this:
• if ((x >= 0.0) && (x <= 1.0))http://www.stemassiut.info prepared By Mr. Osama Ghandour42
•Now you try. Translate the
following English questions into C
conditions.
•Is the temperature temp greater
than 32.0 and less than 212.0?
•Is the height not equal to zero?
•Is the absolute value of pos greater
than 5.0?43
http://www.stemassiut.info prepared By Mr. Osama Ghandour
ExampleDescriptionOperator
(A && B) is false.
Called Logical AND operator. If both the
operands are non-zero, then the condition
becomes true.
&&
(A || B) is true.
Called Logical OR Operator. If any of the
two operands is non-zero, then the
condition becomes true.
||
!(A && B) is true.
Called Logical NOT Operator. It is used to
reverse the logical state of its operand. If a
condition is true, then Logical NOT
operator will make it false.
! http://www.stemassiut.info prepared By Mr. Osama Ghandour44
Example Try the following example to understand all
the logical operators available in C −
#include <stdio.h>
main()
{
int a = 5 , b = 20 , c ;
if ( a && b ) { printf("Line 1 - Condition is truen" ); }
if ( a || b ) { printf("Line 2 - Condition is truen" ); }
/* lets change the value of a and b a = 0 b = 10 */
45 http://www.stemassiut.info prepared By Mr. Osama Ghandour
if ( a && b ){printf("Line3-Condition is truen"); }
else {
printf("Line 3 - Condition is not truen" );
}
if ( !(a && b) ) {
printf("Line 4 - Condition is truen" );
}
}
46 http://www.stemassiut.info prepared By Mr. Osama Ghandour
•When you compile and execute the above
program, it produces the following result −
•Line 1 - Condition is true
•Line 2 - Condition is true
•Line 3 - Condition is not true
•Line 4 - Condition is true
47 http://www.stemassiut.info prepared By Mr. Osama Ghandour
References'
• https://www.google.com.eg/search?q=emf&safe=active&hl=en&biw=
1120&bih=706&site=imghp&source=lnms&sa=X&ved=0ahUKEwicwIz
_hPfLAhVCBBoKHT6qDQAQ_AUIBSgA&dpr=1.25#safe=active&hl=en&
q=emf+definition
• http://www.slideshare.net/mutturajyangi/magneticeffectofelectriccur
rent
• https://www.physicsforums.com/threads/how-do-i-calculate-an-
electric-generators-power.308848/
• STEM Egypt curriculum 2014-2019
http://www.stemassiut.info prepared By Mr. Osama Ghandour48
Home work 2 what are the foolowin functions
and how you can use its in C programming ?
srand((unsigned) time(&t));
rand()
http://www.stemassiut.info prepared By Mr. Osama
Ghandour
49
5 min Reflection
• Mention 2 skills and 2 pits of
knowledge of C programming
you learned today?
Osama Ghandour Geris
Assiut STEM School
50
Be prepared for a
Quiz at the
beginning of
every session
Thank you
Eng. Osama Ghandour

Mais conteúdo relacionado

Semelhante a 2019 session 6 develop programs to solve a variety of problems in math , physics , and games

Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To Know
Kathy Brown
 
TOPIC-1-Introduction and Preliminaries.pdf
TOPIC-1-Introduction and Preliminaries.pdfTOPIC-1-Introduction and Preliminaries.pdf
TOPIC-1-Introduction and Preliminaries.pdf
EjazAlam23
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
Valeriy Kravchuk
 

Semelhante a 2019 session 6 develop programs to solve a variety of problems in math , physics , and games (20)

ch01-basic-java-programs.ppt
ch01-basic-java-programs.pptch01-basic-java-programs.ppt
ch01-basic-java-programs.ppt
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
Learning to Generate Pseudo-code from Source Code using Statistical Machine T...
 
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandourPython week 7 8 2019-2020 for g10 by eng.osama ghandour
Python week 7 8 2019-2020 for g10 by eng.osama ghandour
 
Javascript Programming according to Industry Standards.pptx
Javascript Programming according to Industry Standards.pptxJavascript Programming according to Industry Standards.pptx
Javascript Programming according to Industry Standards.pptx
 
Top Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To KnowTop Tips Every Notes Developer Needs To Know
Top Tips Every Notes Developer Needs To Know
 
ACM init() Spring 2015 Day 1
ACM init() Spring 2015 Day 1ACM init() Spring 2015 Day 1
ACM init() Spring 2015 Day 1
 
Programming intro variables constants - arithmetic and assignment operators
Programming intro variables   constants - arithmetic and assignment operatorsProgramming intro variables   constants - arithmetic and assignment operators
Programming intro variables constants - arithmetic and assignment operators
 
TOPIC-1-Introduction and Preliminaries.pdf
TOPIC-1-Introduction and Preliminaries.pdfTOPIC-1-Introduction and Preliminaries.pdf
TOPIC-1-Introduction and Preliminaries.pdf
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdf
 
pm1
pm1pm1
pm1
 
More about PHP
More about PHPMore about PHP
More about PHP
 
Intro to Python for Non-Programmers
Intro to Python for Non-ProgrammersIntro to Python for Non-Programmers
Intro to Python for Non-Programmers
 
Lecture1
Lecture1Lecture1
Lecture1
 
Python week 4 2019 2020 for g10 by eng.osama ghandour
Python week 4 2019 2020 for g10 by eng.osama ghandourPython week 4 2019 2020 for g10 by eng.osama ghandour
Python week 4 2019 2020 for g10 by eng.osama ghandour
 
PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 
Introduction
IntroductionIntroduction
Introduction
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
 
M.tech admission in india
M.tech admission in indiaM.tech admission in india
M.tech admission in india
 
M.tech admission in india
M.tech admission in indiaM.tech admission in india
M.tech admission in india
 

Mais de Osama Ghandour Geris

Mais de Osama Ghandour Geris (20)

functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
functions in python By Eng. Osama Ghandour الدوال فى البايثون مع مهندس اسامه ...
 
Python cs.1.12 week 10 2020 2021 covid 19 for g10 by eng.osama mansour
Python cs.1.12 week 10  2020 2021 covid 19 for g10 by eng.osama mansourPython cs.1.12 week 10  2020 2021 covid 19 for g10 by eng.osama mansour
Python cs.1.12 week 10 2020 2021 covid 19 for g10 by eng.osama mansour
 
Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
Python cs.1.12 week 9 10  2020-2021 covid 19 for g10 by eng.osama ghandourPython cs.1.12 week 9 10  2020-2021 covid 19 for g10 by eng.osama ghandour
Python cs.1.12 week 9 10 2020-2021 covid 19 for g10 by eng.osama ghandour
 
Python week 7 8 2019-2020 for grade 10
Python week 7 8 2019-2020 for grade 10Python week 7 8 2019-2020 for grade 10
Python week 7 8 2019-2020 for grade 10
 
Mobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osamaMobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osama
 
6 css week12 2020 2021 for g10
6 css week12 2020 2021 for g106 css week12 2020 2021 for g10
6 css week12 2020 2021 for g10
 
Css week11 2020 2021 for g10 by eng.osama ghandour
Css week11 2020 2021 for g10 by eng.osama ghandourCss week11 2020 2021 for g10 by eng.osama ghandour
Css week11 2020 2021 for g10 by eng.osama ghandour
 
Cooding history
Cooding history Cooding history
Cooding history
 
Computer networks--network
Computer networks--networkComputer networks--network
Computer networks--network
 
How to print a sketch up drawing in 3d
How to print a sketch up drawing  in 3dHow to print a sketch up drawing  in 3d
How to print a sketch up drawing in 3d
 
Google sketch up-tutorial
Google sketch up-tutorialGoogle sketch up-tutorial
Google sketch up-tutorial
 
7 types of presentation styles on line
7 types of presentation styles on line7 types of presentation styles on line
7 types of presentation styles on line
 
Design pseudo codeweek 6 2019 -2020
Design pseudo codeweek 6 2019 -2020Design pseudo codeweek 6 2019 -2020
Design pseudo codeweek 6 2019 -2020
 
Php introduction
Php introductionPhp introduction
Php introduction
 
How to use common app
How to use common appHow to use common app
How to use common app
 
Creating databases using xampp w2
Creating databases using xampp w2Creating databases using xampp w2
Creating databases using xampp w2
 
warm up cool down
warm  up cool down warm  up cool down
warm up cool down
 
Flow charts week 5 2020 2021
Flow charts week 5 2020  2021Flow charts week 5 2020  2021
Flow charts week 5 2020 2021
 
Xamppinstallation edited
Xamppinstallation editedXamppinstallation edited
Xamppinstallation edited
 
Bloom s three pyramids
Bloom s three pyramidsBloom s three pyramids
Bloom s three pyramids
 

Último

VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Último (20)

Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 

2019 session 6 develop programs to solve a variety of problems in math , physics , and games

  • 1. http://www.stemassiut.info prepared By Mr. Osama Ghandour 1 1.Read and prepare The C.S. PPT well before session . 2.During session Engage your team work , present , personalize and speak ,Use body language , move and lead your colleges The result is a clever , good personality and communication skills .
  • 2. Agenda of Develop programs to solve a variety of problems in math, and games . - Warming UP : quiz 15 min . - PPT Revision 10 min - PPT presentation 15 min. - code blocks video 5 min . - Using code blocks :- writing different programs for math 10 min - ways to learn programming fast video 5 min - PPT presentation 15 min. - Exit ticket 5 minhttp://www.stemassiut.info prepared By Mr. Osama Ghandour 2
  • 3. Learning Outcome: Describe different basic programming codes and languages. Key Concepts: - • Understand random number generation function. • Understand some mathematics function like Square root . • If statement • Combine conditions using logical operators (&&, ||, and !). • Skills: Design, thinking, analyzing and problem-solving. • Essential Questions: How can we benefit from programming language in solving problems in our daily life? http://www.stemassiut.info prepared By Mr. Osama Ghandour 3
  • 4. Online auto answerd quiz 15 min
  • 5. http://www.stemassiut.info prepared By ENG. Osama Ghandour Data types in C •Only really four basic types: • char • int (short, long, ) • float • double •Size of these types on CLEAR machines: •Sizes of these types vary from one machine to another! Type Size (bytes) Precision char 1 int 2 to 4 short 2 long 4 float 4 6 decimal places double 8 15 decimal places Long double 10 19 decimal places Previous session Press here for on line Press here for off line OR
  • 6. Rules for writing variable name in C •Variable name can be composed of letters (both uppercase and lowercase letters), digits and underscore '_' and Digits ( 0 – 9 ) only •Blanks & Commas are not allowed •No Special Symbols other than underscore(_) are allowed •First Character should be alphabet or Underscore •Variable name Should not be Reserved Wordhttp://www.stemassiut.info prepared By ENG. Osama Ghandour 6
  • 7. • Constants Constants are the terms that can't be changed during the execution of a program. Its preprocessor Syntax as : #define Pi 3.14 or as : const float Pi=3.14 ; • Variables • A variable is just a named area of storage , it is a memory location in computer's memory to store data that can hold a single value its Syntax as : int j=10;http://www.stemassiut.info prepared By ENG. Osama Ghandour7 Constant vs Variable
  • 8. http://www.stemassiut.info prepared By ENG. Osama Ghandour printf("%f", Y ); Previous session Input : In any programming language input means to feed some data into program. This can be given in the form of file or from command line. C programming language provides a set of built-in functions to read given input and feed it to the program as per requirement. scanf("%f",& X); Y=F(x) Output : In any programming language output means to display some data on screen, printer or in any file. C programming language provides a set of built-in functions to output required data.
  • 9.
  • 11. # include <stdio.h> # include <math.h> # include <stdlib.h> /*find the Voltage Value when given the current and resistant values*/ int main() { float current , resistant , voltage ; scanf("%f",&resistant); scanf("%f",& voltage); current = voltage / resistant; printf("%f", ” current = ”, current ); return 0; } http://www.stemassiut.info prepared By ENG. Osama Ghandour
  • 12. How learning happens? I hear… I forget; I see … I remember; I do … I understand. 12
  • 13. Code blocks , Download it , Install it , use it by writing programs. Then be a clever programmer.
  • 14.
  • 16. In math in MA.L.O. 1.07 W 1 : 4 you learned about : • Analyze the functions • quadratic equations , Parabola . • complex numbers • Trigonometric functions http://www.stemassiut.info prepared By Mr. Osama Ghandour 16 In capstone you are required to design a prototype for saving wasted energy o How can things be real and imaginary?
  • 17. Power factor http://www.stemassiut.info prepared By ENG. Osama Ghandour saving wasted energy
  • 18. http://www.stemassiut.info prepared By ENG. Osama Ghandour Power factor
  • 19. http://www.stemassiut.info prepared By ENG. Osama Ghandour Power factor
  • 20. Pr. Home work you studied in physics about electric power and in your capstone about saving wasted energy so design a flowchart for Arduino control circuit to save the consumed energy in electric power circuit . Note : an ideal electric system has power factor PF=0.999 and very low reactive power. http://www.stemassiut.info prepared By ENG. Osama Ghandour
  • 21. Essential questions -Why is modeling an indispensable tool? -Why do we need laws/rules? To be used in programming?http://www.stemassiut.info prepared By Mr. Osama Ghandour 21
  • 22. In math in MA.L.O. 1.08 Week 5 : 7 you will learn about : In C programming you learned about http://www.stemassiut.info prepared By Mr. Osama Ghandour 22 exponential and logarithmic functions pow(num,power)
  • 23. http://www.stemassiut.info prepared By Mr. Osama Ghandour 23 #include<stdio.h> #include<math.h> int main() { int num,power,result; printf("nEnter the numaber and its Power : "); scanf("%d%d",&num,&power); result = pow(num,power); printf("nResult : %d",result); return(0);} //Are we ready to code?
  • 24. In math in MA.L.O. 1.09 Week 8 : 11 you will learn about : In C programming you learned about http://www.stemassiut.info prepared By Mr. Osama Ghandour 24 -Trigonometric functions -sine, cosine and tangent functions cos (degree)
  • 25. http://www.stemassiut.info prepared By Mr. Osama Ghandour 25 Are we ready to code?
  • 26. Essential questions •How do humans make informed decisions, given multiple options? •What factors affect our decisions and how do these factors relate to programmimg models? http://www.stemassiut.info prepared By Mr. Osama Ghandour 26
  • 27. In math in MA.L.O. 1.10 Week 8 : 11 you will learn about : In C programming you learned about http://www.stemassiut.info prepared By Mr. Osama Ghandour 27 Pythagorean Identities sqrt (num);
  • 28. sqrt example #include <stdio.h> #include <math.h> int main () /* sqrt example */ { double param, result; param = 1024.0; result = sqrt (param); printf (“%f%fn", param , result); return 0; } http://www.stemassiut.info prepared By Mr. Osama Ghandour28 //Are we ready to code?
  • 29. See also •log Compute natural logarithm (function). •exp compute exponent of number (function http://www.stemassiut.info prepared By Mr. Osama Ghandour 29
  • 30. Are we ready to code it? Video about using code blocks 30 http://www.stemassiut.info prepared By Mr. Osama Ghandour Press here for on line Press here for off line OR
  • 31. Essential questions •Why use shortcuts? •Why is it essential to have different ways of reaching solutions? http://www.stemassiut.info prepared By Mr. Osama Ghandour 31
  • 32. In math in MA.L.O. 1.12 Week 12 : 14 you will learn about : In C programming write a program to find the values of n unknowns when you given a set of n equations of thesehttp://www.stemassiut.info prepared By Mr. Osama Ghandour 32 1-Matrices 2- System 3- System of equations
  • 33. In mechanics you learned ME.L.O. 1.06 W 3:5 Lami's rule write a C program to find unknown when given required values ME. L.O. 1.07 W 6:8 Newton's 2nd law write a C program to find unknown when given required values http://www.stemassiut.info prepared By Mr. Osama Ghandour 33
  • 34. In Physics you are learning in PH. L.O. 1.08 W 1:3 1. Fluids , 2. Pressure , 3. Archimedes Principle PH. L.O. 1.09 W 4:6 1. Continuity equation , 2. Work-Energy Theorem , 3. Bernoulli Equation PH. L.O. 1.11 W 10:12 1-1st Law of Thermodynamics http://www.stemassiut.info prepared By Mr. Osama Ghandour 34 Write C programs to find automated solutions for each of the above equations and or laws
  • 35.
  • 36. Home work 1 Write a cprogram for application which uses the continuity equation a1*v1 = a2*v2 where a and v are area and velocity respectively . 36 http://www.stemassiut.info prepared By Mr. Osama Ghandour
  • 37.
  • 38. Design a c program for calculating the EMF (Electromotive force )using faraday's law of induction equation http://www.stemassiut.info preparedBy Mr. Osama Ghandour38 What is and where wastedenergy here ?
  • 39. Are we ready to code it? 6 ways to learn programming fast 39 http://www.stemassiut.info prepared By Mr. Osama Ghandour Press here for on line Press here for off line OR
  • 40. •If statement. •Combine conditions using logical operators (&&, ||, !). http://www.stemassiut.info prepared By Mr. Osama Ghandour 40
  • 41. • The conditions in if statements are built out of relational and logical operators. The six relational operators that C provides for comparing numbers: == != > < >= <= • But suppose you need to know if the value of the variable x is both greater than zero and less than one? None of these relational operators by itself can answer that question. What you need is to combine two conditions: • (x > 0.0) and (y < 1.0) 41 http://www.stemassiut.info prepared By Mr. Osama Ghandour
  • 42. •This is what logical operators can do for you. A logical operator combines one or two conditions into a single new condition. C provides three logical operators: •``&&'' (two ampersands) means and. •``||'' (two vertical bars) means or. •``!'' (an exclamation point) means not. •Let's look at an example. If you need to know if the value of the variable x is between zero and one, inclusive, you would write this: • if ((x >= 0.0) && (x <= 1.0))http://www.stemassiut.info prepared By Mr. Osama Ghandour42
  • 43. •Now you try. Translate the following English questions into C conditions. •Is the temperature temp greater than 32.0 and less than 212.0? •Is the height not equal to zero? •Is the absolute value of pos greater than 5.0?43 http://www.stemassiut.info prepared By Mr. Osama Ghandour
  • 44. ExampleDescriptionOperator (A && B) is false. Called Logical AND operator. If both the operands are non-zero, then the condition becomes true. && (A || B) is true. Called Logical OR Operator. If any of the two operands is non-zero, then the condition becomes true. || !(A && B) is true. Called Logical NOT Operator. It is used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false. ! http://www.stemassiut.info prepared By Mr. Osama Ghandour44
  • 45. Example Try the following example to understand all the logical operators available in C − #include <stdio.h> main() { int a = 5 , b = 20 , c ; if ( a && b ) { printf("Line 1 - Condition is truen" ); } if ( a || b ) { printf("Line 2 - Condition is truen" ); } /* lets change the value of a and b a = 0 b = 10 */ 45 http://www.stemassiut.info prepared By Mr. Osama Ghandour
  • 46. if ( a && b ){printf("Line3-Condition is truen"); } else { printf("Line 3 - Condition is not truen" ); } if ( !(a && b) ) { printf("Line 4 - Condition is truen" ); } } 46 http://www.stemassiut.info prepared By Mr. Osama Ghandour
  • 47. •When you compile and execute the above program, it produces the following result − •Line 1 - Condition is true •Line 2 - Condition is true •Line 3 - Condition is not true •Line 4 - Condition is true 47 http://www.stemassiut.info prepared By Mr. Osama Ghandour
  • 48. References' • https://www.google.com.eg/search?q=emf&safe=active&hl=en&biw= 1120&bih=706&site=imghp&source=lnms&sa=X&ved=0ahUKEwicwIz _hPfLAhVCBBoKHT6qDQAQ_AUIBSgA&dpr=1.25#safe=active&hl=en& q=emf+definition • http://www.slideshare.net/mutturajyangi/magneticeffectofelectriccur rent • https://www.physicsforums.com/threads/how-do-i-calculate-an- electric-generators-power.308848/ • STEM Egypt curriculum 2014-2019 http://www.stemassiut.info prepared By Mr. Osama Ghandour48
  • 49. Home work 2 what are the foolowin functions and how you can use its in C programming ? srand((unsigned) time(&t)); rand() http://www.stemassiut.info prepared By Mr. Osama Ghandour 49
  • 50. 5 min Reflection • Mention 2 skills and 2 pits of knowledge of C programming you learned today? Osama Ghandour Geris Assiut STEM School 50
  • 51. Be prepared for a Quiz at the beginning of every session