The document discusses loops in C programming. It provides examples of using for loops to print stars, numbers from 1 to 10, and numbers from 1 to 1000. The for loop syntax of initialization, condition, and increment is explained. Additional examples are given to illustrate using arithmetic expressions and incrementing/decrementing the counter variable. The for loop provides an efficient way to repeat a block of code a fixed number of times without lengthy repetitive code.
The document contains lecture notes from Dr. Muhammad Yousaf Hamza on computing fundamentals and nested loops. It includes examples of C programs to print star patterns using for loops, and modifications to print different patterns. It encourages the reader to write programs to print additional star patterns on their own.
The document discusses various topics related to file handling and sorting algorithms in C programming. It begins with an introduction to file handling, describing how to open, write, and read from files. It then covers different modes for opening files and examples of writing data to multiple files. The document later discusses linear and binary search algorithms for arrays as well as bubble, selection, and insertion sorts. Code examples are provided for each algorithm discussed.
The document discusses recursion and pointers in C programming. It provides examples of using recursion to calculate factorials and print a series of numbers. Recursion involves defining a base case and dividing a problem into sub-problems that are similar to the original problem. Pointers store memory addresses and can be used to pass arguments by reference. The address operator & returns the memory address of a variable, while the indirection operator * accesses the value at a pointer's address. Pointers allow returning multiple values from functions and are important for advanced data structures.
1. The document discusses various input/output functions in C including printf(), scanf(), putchar(), getchar(), gets(), and puts(). It provides examples of using format specifiers like %d, %c, %s in printf and scanf.
2. Function prototypes and uses of various I/O functions are demonstrated through simple code snippets. Examples show declaring and initializing variables, performing arithmetic operations, character manipulation, string input/output and formatted output.
3. Comments explain the purpose and usage of standard input/output header file stdio.h and each I/O function discussed. Formatted output using field widths and justifications is also demonstrated.
1. The document discusses various input/output functions in C including printf(), scanf(), putchar(), gets(), and puts(). It provides examples of using format specifiers like %d, %f, %c with printf and scanf.
2. Functions like putchar() and gets() are used to output/input single characters and strings. Examples demonstrate using gets() to accept user input and puts() to output strings.
3. The last section provides more complex examples combining multiple functions like printf(), scanf(), gets() to perform input/output operations and manipulate strings.
This document contains an R programming work sample that includes:
1) Performing partial and robust regression analysis, hypothesis testing, and residual diagnostics on various datasets.
2) Identifying outliers and influential points through plots and tests.
3) Testing hypotheses about regression coefficients and determining if assumptions are met.
4) Exploring transformations to stabilize variance and improve model fit.
The document provides information about Python programming language:
- Python was created in the late 1980s and became widely popular in the early 2000s.
- It is a high-level, general-purpose, interpreted programming language that can be used for web, desktop, game development, data science, and more.
- Some key features of Python include dynamic typing, automatic memory management, and being multi-paradigm supporting object-oriented, imperative, functional programming styles.
The document discusses automatic versus static variables in C programming. It provides examples of functions with automatic and static variables. Automatic variables are reinitialized each time the function is called, while static variables retain their value between calls. The document also discusses recursion, providing examples of recursive functions to calculate factorials and generate the Fibonacci series. Recursion involves functions calling themselves until a base case is reached.
The document contains lecture notes from Dr. Muhammad Yousaf Hamza on computing fundamentals and nested loops. It includes examples of C programs to print star patterns using for loops, and modifications to print different patterns. It encourages the reader to write programs to print additional star patterns on their own.
The document discusses various topics related to file handling and sorting algorithms in C programming. It begins with an introduction to file handling, describing how to open, write, and read from files. It then covers different modes for opening files and examples of writing data to multiple files. The document later discusses linear and binary search algorithms for arrays as well as bubble, selection, and insertion sorts. Code examples are provided for each algorithm discussed.
The document discusses recursion and pointers in C programming. It provides examples of using recursion to calculate factorials and print a series of numbers. Recursion involves defining a base case and dividing a problem into sub-problems that are similar to the original problem. Pointers store memory addresses and can be used to pass arguments by reference. The address operator & returns the memory address of a variable, while the indirection operator * accesses the value at a pointer's address. Pointers allow returning multiple values from functions and are important for advanced data structures.
1. The document discusses various input/output functions in C including printf(), scanf(), putchar(), getchar(), gets(), and puts(). It provides examples of using format specifiers like %d, %c, %s in printf and scanf.
2. Function prototypes and uses of various I/O functions are demonstrated through simple code snippets. Examples show declaring and initializing variables, performing arithmetic operations, character manipulation, string input/output and formatted output.
3. Comments explain the purpose and usage of standard input/output header file stdio.h and each I/O function discussed. Formatted output using field widths and justifications is also demonstrated.
1. The document discusses various input/output functions in C including printf(), scanf(), putchar(), gets(), and puts(). It provides examples of using format specifiers like %d, %f, %c with printf and scanf.
2. Functions like putchar() and gets() are used to output/input single characters and strings. Examples demonstrate using gets() to accept user input and puts() to output strings.
3. The last section provides more complex examples combining multiple functions like printf(), scanf(), gets() to perform input/output operations and manipulate strings.
This document contains an R programming work sample that includes:
1) Performing partial and robust regression analysis, hypothesis testing, and residual diagnostics on various datasets.
2) Identifying outliers and influential points through plots and tests.
3) Testing hypotheses about regression coefficients and determining if assumptions are met.
4) Exploring transformations to stabilize variance and improve model fit.
The document provides information about Python programming language:
- Python was created in the late 1980s and became widely popular in the early 2000s.
- It is a high-level, general-purpose, interpreted programming language that can be used for web, desktop, game development, data science, and more.
- Some key features of Python include dynamic typing, automatic memory management, and being multi-paradigm supporting object-oriented, imperative, functional programming styles.
The document discusses automatic versus static variables in C programming. It provides examples of functions with automatic and static variables. Automatic variables are reinitialized each time the function is called, while static variables retain their value between calls. The document also discusses recursion, providing examples of recursive functions to calculate factorials and generate the Fibonacci series. Recursion involves functions calling themselves until a base case is reached.
The document discusses various C programming concepts including infinite loops, break, continue, and goto statements. It provides code examples to demonstrate how these statements work, such as using break to exit a loop early or continue to skip the remaining code in the current loop iteration. The exit() function is also covered as a way to terminate a program mid-execution. Overall the document serves as teaching material on flow control statements and functions in C.
The document discusses functions in C programming. It provides examples of functions that return values, functions that accept arguments, and functions that call other functions. It also discusses concepts like scope of variables, passing arguments by value, and returning values from functions. Functions are defined as blocks of code that perform a specific task and can be reused. The examples demonstrate how to write functions and call them from other parts of the code.
The document discusses various loop constructs in C programming such as while, do-while, and for loops. It provides examples of using each loop to count from 1 to 10, print even numbers between two given integers, and calculate a factorial. The key differences between each loop are explained, such as how for loops are preferable when the number of iterations is known beforehand and do-while loops will always execute the body at least once.
At the end of this lecture students should be able to;
Describe the looping structures in C programming language.
Practice the control flow of different looping structures in C programming language.
Practice the variants in control flow of different looping structures in C programming language.
Apply taught concepts for writing programs.
The document discusses the anatomy of a C program through an example program. It begins with preprocessor directives like #include that link standard libraries. The main() function acts as the entry point and contains variable declarations and executable code. Variables are initialized, a calculation is performed, and printf displays the output. Braces define code blocks and return 0 indicates successful program termination. Comments help explain the code through comment delimiters like // and /* */.
The document contains code examples and explanations of conditional statements in C programming. It discusses if, if-else, if-else if statements and uses examples to demonstrate how to check conditions and execute different code blocks based on whether the conditions are true or false. It also covers logical operators like &&, || and ! that are used to combine multiple conditions. Finally, it briefly introduces the ternary conditional operator ?: that allows writing if-else statements in a single line.
This document provides information about computing fundamentals and C programming concepts such as data types, variables, operators, and decision making structures. It includes code examples demonstrating the use of scanf to read input, basic arithmetic operators, if statements, and more. The document is authored by Dr. Muhammad Yousaf Hamza and covers fundamental C programming topics for beginners.
This document discusses various control structures in C programming including decision making statements (if, if-else, nested if-else, switch), loops (do-while, while, for), and unconditional branching (break, continue, goto). Examples are provided for each type of control structure to demonstrate their syntax and usage. Key control structures like if-else ladders and nested loops are explained through examples like finding the maximum of three numbers and printing patterns using nested for loops.
The document discusses arrays in C programming. It begins by explaining what arrays are and how they are declared and initialized. It provides examples of one-dimensional arrays and shows how to print, read from, and perform calculations on array elements. The document also discusses important points about arrays like initializing with fewer values than size, scanning more values than size, and accessing out of bounds elements. It provides examples of using arrays to find sum, maximum value, and reordering elements based on user input.
This document discusses control statements in C programming. It covers different types of control statements like decision structures (if, if-else, nested if), the switch statement, and repetition structures (for, while, continue loops). It provides examples of if, if-else, and switch-case statements. Key topics include branching based on conditions, logical and relational operators, compound statements, nested control structures, and avoiding common errors with switch statements.
The document discusses different types of looping statements in structured programming languages including for, while, and do-while loops. It provides examples of the syntax and control flow for each loop type. The key points made are:
1) Loops are used to perform repetitive tasks by executing a block of code multiple times. The main loop types are for, while, and do-while.
2) The for loop initializes a counter variable, checks a condition, and updates the counter each iteration.
3) The while loop checks a condition before each iteration and updates the counter within the loop body.
4) The do-while loop executes the body at least once even if the condition is false, then
Bubble Sort,Insertion Sort, Structures,Students Mark statement ,Pointers, Arithmetic operations on pointers, Files,Creating file, Reading file,Writing a text file,binary file,lab programs,c programs,example programs,c program,Bubble Sort in c,Insertion Sort in c, Structures in c,Students Mark statement in c ,Pointers in c, Arithmetic operations on pointers in c, Files in c,Creating file in c, Reading file in c,Writing a text file in c,binary file in c,lab program in c,c program,example program,c program,thiruvalluvar university,lab manual,c lab manual
This document discusses various control structures in programming like if-else statements, switch statements, and loops. It provides syntax and examples of using if-else statements to execute code conditionally based on simple or nested conditions. Switch statements allow selecting between multiple code blocks based on a variable's value. Loops like for, while, and do-while loops are covered, which allow repetitive execution of code. The break and continue statements are also introduced to control loop flow. Examples are provided to demonstrate different control structures for problems like finding largest of numbers, checking positive/negative/zero, and character input validation.
This document provides an overview of the C programming language, including its basic structure and components. It discusses C program syntax, data types, operators, control flow, functions, pointers and arrays, structures, input/output, and more. Examples are provided throughout to illustrate key concepts such as variables, expressions, if/else statements, loops, pointers, structures, unions, and standard library functions. The document is intended to teach the fundamentals of the C language.
This document contains program code and notes about programming concepts like procedures, functions, variables, sets, and arrays. It discusses different types of variables, set operations, reading and printing sets, and provides examples of code for inputting and outputting sets. It also provides exercises for students to practice creating programs that work with student data stored in sets and arrays.
This document contains program code and notes about programming concepts like procedures, functions, variables, sets, and arrays. It discusses different types of variables, set operations, reading and printing sets, and provides examples of code for procedures to input and output sets. It also provides exercises asking the reader to write a program to manage student enrollment in math and English classes using sets and arrays.
The document provides information on C programming concepts including data types, operators, control structures, and loops. It includes code examples to demonstrate printf() and scanf() functions, if/else conditional statements, while and for loops. It also defines relational, logical, and ternary operators and explains the three basic control structures: sequence, selection, and iteration. Key concepts around while, do-while, for loops and switch/case statements are described.
The document discusses various string handling functions in C including strlen(), strcpy(), strcat(), strlwr(), strupr(), strchr(), and continues. It provides examples of using each function, such as using strlen() to get the length of a string, strcpy() to copy one string to another, and strcat() to concatenate two strings. It also discusses using continue in a for loop to count vowels and consonants in a string. The document is authored by Dr. Muhammad Yousaf Hamza and covers fundamental computing and C string operations.
The document discusses various control structures in C including loops. It covers while, do-while, and for loops. It provides examples of using each loop type to calculate a grade point average (GPA) using both counter-controlled and sentinel-controlled repetition. Key differences between while, do-while and for loops are explained along with flowcharts demonstrating the logic flow for each. Common errors to avoid with loops in C are also listed.
1) The document discusses structures in C programming, which allow grouping of related data types into a single data type.
2) A structure called student is defined containing member variables like rollnumber, semnumber, and age_years. A variable of this structure type is initialized and its members are accessed.
3) Structures can contain other structures to represent nested relationships between data. They provide a way to organize and manage related data in an application.
Arrays and pointers have a close relationship in C. An array name is a pointer to the first element of the array. Pointers can be used to access and modify array elements. Functions can modify arrays passed by reference by using pointers to the array elements. Pointer arithmetic and array indexing are equivalent and allow accessing successive elements of an array. Pointers to arrays can be returned from functions to access modified arrays.
The document discusses various C programming concepts including infinite loops, break, continue, and goto statements. It provides code examples to demonstrate how these statements work, such as using break to exit a loop early or continue to skip the remaining code in the current loop iteration. The exit() function is also covered as a way to terminate a program mid-execution. Overall the document serves as teaching material on flow control statements and functions in C.
The document discusses functions in C programming. It provides examples of functions that return values, functions that accept arguments, and functions that call other functions. It also discusses concepts like scope of variables, passing arguments by value, and returning values from functions. Functions are defined as blocks of code that perform a specific task and can be reused. The examples demonstrate how to write functions and call them from other parts of the code.
The document discusses various loop constructs in C programming such as while, do-while, and for loops. It provides examples of using each loop to count from 1 to 10, print even numbers between two given integers, and calculate a factorial. The key differences between each loop are explained, such as how for loops are preferable when the number of iterations is known beforehand and do-while loops will always execute the body at least once.
At the end of this lecture students should be able to;
Describe the looping structures in C programming language.
Practice the control flow of different looping structures in C programming language.
Practice the variants in control flow of different looping structures in C programming language.
Apply taught concepts for writing programs.
The document discusses the anatomy of a C program through an example program. It begins with preprocessor directives like #include that link standard libraries. The main() function acts as the entry point and contains variable declarations and executable code. Variables are initialized, a calculation is performed, and printf displays the output. Braces define code blocks and return 0 indicates successful program termination. Comments help explain the code through comment delimiters like // and /* */.
The document contains code examples and explanations of conditional statements in C programming. It discusses if, if-else, if-else if statements and uses examples to demonstrate how to check conditions and execute different code blocks based on whether the conditions are true or false. It also covers logical operators like &&, || and ! that are used to combine multiple conditions. Finally, it briefly introduces the ternary conditional operator ?: that allows writing if-else statements in a single line.
This document provides information about computing fundamentals and C programming concepts such as data types, variables, operators, and decision making structures. It includes code examples demonstrating the use of scanf to read input, basic arithmetic operators, if statements, and more. The document is authored by Dr. Muhammad Yousaf Hamza and covers fundamental C programming topics for beginners.
This document discusses various control structures in C programming including decision making statements (if, if-else, nested if-else, switch), loops (do-while, while, for), and unconditional branching (break, continue, goto). Examples are provided for each type of control structure to demonstrate their syntax and usage. Key control structures like if-else ladders and nested loops are explained through examples like finding the maximum of three numbers and printing patterns using nested for loops.
The document discusses arrays in C programming. It begins by explaining what arrays are and how they are declared and initialized. It provides examples of one-dimensional arrays and shows how to print, read from, and perform calculations on array elements. The document also discusses important points about arrays like initializing with fewer values than size, scanning more values than size, and accessing out of bounds elements. It provides examples of using arrays to find sum, maximum value, and reordering elements based on user input.
This document discusses control statements in C programming. It covers different types of control statements like decision structures (if, if-else, nested if), the switch statement, and repetition structures (for, while, continue loops). It provides examples of if, if-else, and switch-case statements. Key topics include branching based on conditions, logical and relational operators, compound statements, nested control structures, and avoiding common errors with switch statements.
The document discusses different types of looping statements in structured programming languages including for, while, and do-while loops. It provides examples of the syntax and control flow for each loop type. The key points made are:
1) Loops are used to perform repetitive tasks by executing a block of code multiple times. The main loop types are for, while, and do-while.
2) The for loop initializes a counter variable, checks a condition, and updates the counter each iteration.
3) The while loop checks a condition before each iteration and updates the counter within the loop body.
4) The do-while loop executes the body at least once even if the condition is false, then
Bubble Sort,Insertion Sort, Structures,Students Mark statement ,Pointers, Arithmetic operations on pointers, Files,Creating file, Reading file,Writing a text file,binary file,lab programs,c programs,example programs,c program,Bubble Sort in c,Insertion Sort in c, Structures in c,Students Mark statement in c ,Pointers in c, Arithmetic operations on pointers in c, Files in c,Creating file in c, Reading file in c,Writing a text file in c,binary file in c,lab program in c,c program,example program,c program,thiruvalluvar university,lab manual,c lab manual
This document discusses various control structures in programming like if-else statements, switch statements, and loops. It provides syntax and examples of using if-else statements to execute code conditionally based on simple or nested conditions. Switch statements allow selecting between multiple code blocks based on a variable's value. Loops like for, while, and do-while loops are covered, which allow repetitive execution of code. The break and continue statements are also introduced to control loop flow. Examples are provided to demonstrate different control structures for problems like finding largest of numbers, checking positive/negative/zero, and character input validation.
This document provides an overview of the C programming language, including its basic structure and components. It discusses C program syntax, data types, operators, control flow, functions, pointers and arrays, structures, input/output, and more. Examples are provided throughout to illustrate key concepts such as variables, expressions, if/else statements, loops, pointers, structures, unions, and standard library functions. The document is intended to teach the fundamentals of the C language.
This document contains program code and notes about programming concepts like procedures, functions, variables, sets, and arrays. It discusses different types of variables, set operations, reading and printing sets, and provides examples of code for inputting and outputting sets. It also provides exercises for students to practice creating programs that work with student data stored in sets and arrays.
This document contains program code and notes about programming concepts like procedures, functions, variables, sets, and arrays. It discusses different types of variables, set operations, reading and printing sets, and provides examples of code for procedures to input and output sets. It also provides exercises asking the reader to write a program to manage student enrollment in math and English classes using sets and arrays.
The document provides information on C programming concepts including data types, operators, control structures, and loops. It includes code examples to demonstrate printf() and scanf() functions, if/else conditional statements, while and for loops. It also defines relational, logical, and ternary operators and explains the three basic control structures: sequence, selection, and iteration. Key concepts around while, do-while, for loops and switch/case statements are described.
The document discusses various string handling functions in C including strlen(), strcpy(), strcat(), strlwr(), strupr(), strchr(), and continues. It provides examples of using each function, such as using strlen() to get the length of a string, strcpy() to copy one string to another, and strcat() to concatenate two strings. It also discusses using continue in a for loop to count vowels and consonants in a string. The document is authored by Dr. Muhammad Yousaf Hamza and covers fundamental computing and C string operations.
The document discusses various control structures in C including loops. It covers while, do-while, and for loops. It provides examples of using each loop type to calculate a grade point average (GPA) using both counter-controlled and sentinel-controlled repetition. Key differences between while, do-while and for loops are explained along with flowcharts demonstrating the logic flow for each. Common errors to avoid with loops in C are also listed.
1) The document discusses structures in C programming, which allow grouping of related data types into a single data type.
2) A structure called student is defined containing member variables like rollnumber, semnumber, and age_years. A variable of this structure type is initialized and its members are accessed.
3) Structures can contain other structures to represent nested relationships between data. They provide a way to organize and manage related data in an application.
Arrays and pointers have a close relationship in C. An array name is a pointer to the first element of the array. Pointers can be used to access and modify array elements. Functions can modify arrays passed by reference by using pointers to the array elements. Pointer arithmetic and array indexing are equivalent and allow accessing successive elements of an array. Pointers to arrays can be returned from functions to access modified arrays.
The document discusses computing fundamentals and functions in C programming. It begins with examples of adding two integers with and without a function. It then defines key terms related to functions such as function prototype, definition, header, calling a function, passing arguments, and returning a value. The document provides examples and notes about different types of functions and their components. It discusses benefits of using functions such as modularity, reusability, and avoiding code repetition.
The document discusses computing fundamentals and string manipulation in C programming. It covers ASCII codes, comparing strings, generating random numbers and the Fibonacci sequence. ASCII codes assign numeric values to characters that are stored in computer memory. Strings can be compared using strcmp() which returns 0 if equal or >0 if the first string is greater. Random numbers are generated between 1-100 using rand()%100+1. The Fibonacci sequence is generated by adding the previous two values to get the next one in the series.
The document discusses computing fundamentals and strings in C programming. It covers that characters are the building blocks of programs and strings are arrays of characters that end with a null character. It provides examples of declaring and initializing strings, printing strings, accessing individual characters, and modifying strings.
The document discusses storing and manipulating two-dimensional arrays in C programming. It explains how to define two-dimensional arrays using nested brackets, initialize them with values, and access elements using row and column subscripts. It also demonstrates how to print two-dimensional arrays in a matrix format using for loops, and provides examples of adding and multiplying matrices using two-dimensional arrays.
The document discusses arrays in C programming. It begins by defining an array as a structure that contains a group of related data items of the same type. It notes that arrays allow accessing elements via an index, with the first element having an index of 0. The document then provides examples of declaring, initializing, accessing, and printing single-dimensional and multi-dimensional arrays. It also demonstrates how to store user input into arrays and perform operations like addition and multiplication on 2D arrays representing matrices.
This document contains a summary of computing fundamentals and C programming concepts provided by Dr. Muhammad Yousaf Hamza. It includes:
1) An example C program that declares variables, performs basic math operations, and prints outputs using printf.
2) An explanation of escape sequences in C and examples of their usage.
3) Guidelines for naming variables in C, including allowed characters and conventions.
4) An overview of comments in C, including how to write single-line and multi-line comments.
This document provides information about a computing fundamentals course taught by Dr. Muhammad Yousaf Hamza. It includes details about the instructor's qualifications, course contents covering basic computer components and programming in C, recommended textbooks, and objectives of the course which are to learn computer fundamentals and the C programming language. It also presents sample C code for a basic program that calculates the sum and difference of two integers as an example of the first program students will write in the course.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
3. #include <stdio.h>
int main()
{
int day;
printf("The day number 1 means Mondayn");
printf("Please enter the number of day. n The number must be
any integer value from 1 to 7n");
scanf("%d",&day);
if (day == 1)
printf("Mondayn");
else if (day == 2)
printf("Tuesdayn");
else if (day == 3)
printf("Wednesdayn");
// You may complete it yourself
Dr. Yousaf, PIEAS
4. The if/else Selection Structure
Nested if/else structures
• In previous example, the nested if/else structure is to
be used.
• Test for multiple cases by placing if/else selection
structures inside if/else selection structures
• Deep indentation usually not used in practice
• How can we solve this example more conveniently?
• Switch statement is a convenient way to code it.
Dr. Yousaf, PIEAS
5. Switch Statement
If you have a large decision tree, and all
the decisions depend on the value of the
same variable, you will probably want to
consider a switch statement instead of a
ladder of if...else or else if constructions.
Dr. Yousaf, PIEAS
6. // Example of switch statement
#include <stdio.h>
int main()
{
int day;
printf("The day number 1 means Mondayn");
printf("Please enter the number of day. n The
number must be any integer value from
1 to 7n");
scanf("%d",&day);
// Contd. (next page)
Dr. Yousaf, PIEAS
7. switch(day)
{
case 1: // 1 is one of possible value of day and so on.
printf("Mondayn");
break;
case 2:
printf("Tuesdayn");
break;
// please write cases 3 to 6 yourself
case 7:
printf("Sundayn");
break;
default:
printf("The number must be any integer value from 1 to 7n");
break;
}
getchar(); return 0;
}
Dr. Yousaf, PIEAS
8. • switch
– Useful when a variable or expression is tested for all the
values which can happen and different actions are taken
• Format
– Series of case labels and an optional default case
switch ( value )
{
case 1:
actions
case 2:
actions
default:
actions
}
– break; exits from structure
Dr. Yousaf, PIEAS
9. The switch Structure
• Flowchart of the switch structure
true
false
.
.
.
case a case a
action(s)
break
case b case b
action(s)
break
false
false
case z case z
action(s)
break
true
true
default
action(s)
Dr. Yousaf, PIEAS
10. • The expression used in a switch statement must have an integral or
character type.
• You can have any number of case statements within a switch. Each case
is followed by the value to be compared and a colon.
• The constant-expression for a case must be the same data type as the
variable in the switch, and it must be a constant or a literal.
• When the variable being switched on is equal to a case, the statements
following that case will execute until a break statement is reached.
• When a break statement is reached, the switch terminates, and the flow
of control jumps to the next line following the switch statement.
• Not every case needs to contain a break. If no break appears, the flow of
control will fall through to subsequent cases until a break is reached.
• A switch statement can have an optional default case, which must
appear at the end of the switch. The default case can be used for
performing a task when none of the cases is true. No break is needed in
the default case.
Dr. Muhammad Yousaf Hamza
Switch Statement
12. #include<stdio.h>
#include<math.h> // use of math.h
#define PI 3.14
int main()
{
double y;
y = sin(PI/2.0); // argument is in radian
printf("%lf", y);
getchar();
return 0;
}
Output: 1.000000
Dr. Yousaf, PIEAS
13. // If given theta is in degree, then convert it first into radians.
#include<stdio.h>
#include<math.h> // use of math.h
#define PI 3.14
int main()
{
double y;
float theta_deg, theta_rad;
theta_deg = 90.0;
theta_rad = (PI/180)*theta_deg;
y = sin(theta_rad); // argument is in radian
printf("%lf", y);
getchar(); return 0; }
Output: 1.000000
Dr. Yousaf, PIEAS
24. Examples
Write a program that prints 10 stars as
Dr. Yousaf, PIEAS
#include<stdio.h>
int main()
{
printf("*n*n*n*n*n*n*n*n*n*");
getchar();
return 0;
}
25. Examples
Write a program that prints 100 stars in the format
shown in the previous slides.
Dr. Yousaf, PIEAS
26. Examples
Write a program that prints 100 stars in the format
shown in the previous slides.
Too much labor work?
There MUST be an easier way
Dr. Yousaf, PIEAS
28. Examples
Write a program that prints counting 1 to 10 as
Dr. Yousaf, PIEAS
#include<stdio.h>
int main()
{
printf("1n2n3n4n5n6n7n8n9n10");
getchar();
return 0;
}
29. Examples
Write a program that prints counting from 1 to 1000 in
the format shown in the previous slide.
Dr. Yousaf, PIEAS
30. Examples
Write a program that prints counting from 1 to 1000 in
the format shown in the previous slide.
• Too much labor work?
• There MUST be an easier way
• Is there any?
• YES
LOOPS
Dr. Yousaf, PIEAS
34. Printing the counting from 1 to 10
#include<stdio.h>
int main()
{
int i;
for (i = 1; i <= 10; i++)
printf("%dn", i);
getchar();
return 0;
}
Dr. Yousaf, PIEAS
35. Printing the counting from 1 to 1000
#include<stdio.h>
int main()
{
int i;
for (i = 1; i <= 1000; i++)
printf("i = %dn", i);
getchar();
return 0;
}
Dr. Yousaf, PIEAS
37. The for Statement
• The most important looping structure in C.
• Generic Form:
for (initial ; condition ; increment )
statement
• initial, condition, and increment are C expressions.
• For loops are executed as follows:
1. initial is evaluated. Usually an assignment statement.
2. condition is evaluated. Usually a relational expression.
3. If condition is false (i.e. 0), fall out of the loop (go to step 6.)
4. If condition is true (i.e. nonzero), execute statement
5. Execute increment and go back to step 2.
6. Next statement
38. The for Statement
//For statement examples
#include <stdio.h>
int main ()
{
int count;
/* 1. simple counted for loop */
printf("Output with increment in loopn");
for (count =1; count <=10; count++)
printf ("%dn", count);
/* 2. counting backwards */
printf("Output with decrement in loopn");
for (count = 56; count >48; count--)
printf("%dn", count);
/* 3. for loop counting by
5's */
printf("Output with increment
of 5n");
for (count=0; count<32;
count += 5)
printf("%dn", count);
getchar();
return 0;
}
39. The for Statement
#include <stdio.h>
int main ()
{
int count;
/* initialization outside of loop */
count = 1;
for ( ; count < 7; count++)
printf("%d ", count);
printf(“n");
/* increment outside of loop */
count = 1;
for ( ; count < 7; )
{
printf("%d ", count);
count++;
}
getchar(); return 0; }
40. #include <stdio.h>
int main ()
{
int count;
int x, y;
/* compound statements increment */
for (x=0, y=100; x<y; x++, y--)
{
printf("%d, %dn", x,y);
}
getchar();
return 0;
}
Dr. Yousaf, PIEAS
The for Statement
41. The for Repetition Structure
• Format when using for loops
for ( initialization; loopContinuationTest; increment )
statement
• Example:
for (i = 1; i <= 10; i++)
printf("i = %dn", i);
–Prints the integers from one to ten
No
semicolon
(;) after last
expression
Dr. Yousaf, PIEAS
42. The for Structure: Observations
• Arithmetic expressions
Initialization, loop-continuation, and increment can
contain arithmetic expressions.
x = 2;
y = 10;
for ( j = x; j <= 4 * x * y; j += y / x )
is equivalent to
for ( j = 2; j <= 80; j += 5 )
Dr. Yousaf, PIEAS
43. The for Structure: Observations
• Notes about the for structure:
– "Increment" may be negative (decrement)
– If the loop continuation condition is initially
false
• The body of the for structure is not
performed
• Control proceeds with the next statement
after the for structure
– Control variable // for (i = 1; i <= 10; i++)
• Often printed or used inside for body, but not
necessary
Dr. Yousaf, PIEAS
44. For Loop
#include <stdio.h>
int main()
{
int x;
/* The loop goes if x < 10, and x increases by one in every
loop*/
for ( x = 0; x < 10; x++ )
{
/* Keep in mind that the loop condition checks
the conditional statement before it loops again.
consequently, when x equals 10 the loop breaks.
x is updated before the condition is checked. */
printf( "%dn", x );
}
return 0;
}
Dr. Yousaf, PIEAS