1. A programming language allows writing instructions as programs to perform tasks. Programs are written in human-readable languages and compiled into machine-readable code.
2. C is one of the earliest and most widely used programming languages. Key aspects of C include data types, keywords, operators, variables, conditional and looping statements, and functions.
3. Programming involves concepts like conditional logic, loops, functions, and data types to solve problems through coded instructions.
This page contains examples and source code on decision making in C programming (to choose a particular statement among many statements) and loops ( to perform repeated task ). To understand all the examples on this page, you should have knowledge of following topics:
if...else Statement
for Loop
while Loop
break and Continue Statement
switch...case
C lecture 3 control statements slideshareGagan Deep
Control Statement in C, Looping in C, Conditional and Unconditional Statements, For Loop, While Loop, Do-While Loop, C Programming, Examples : Visit us at www.rozyph.com
Detailing about basics of C language and its control structure for learning C Language for beginners. It covers looping statement , control statement etc.
This page contains examples and source code on decision making in C programming (to choose a particular statement among many statements) and loops ( to perform repeated task ). To understand all the examples on this page, you should have knowledge of following topics:
if...else Statement
for Loop
while Loop
break and Continue Statement
switch...case
C lecture 3 control statements slideshareGagan Deep
Control Statement in C, Looping in C, Conditional and Unconditional Statements, For Loop, While Loop, Do-While Loop, C Programming, Examples : Visit us at www.rozyph.com
Detailing about basics of C language and its control structure for learning C Language for beginners. It covers looping statement , control statement etc.
Decision-making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be
executed if the condition is determined to be true, and
optionally, other statements to be executed if the condition is determined to be false.
Shown below is the general form of a typical decision-making structure found in most of the programming languages:
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
this slide is for to understand the conditions which are applied in C++ programming language. I hope u would understand better by viewing this presentation.
Decision-making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be
executed if the condition is determined to be true, and
optionally, other statements to be executed if the condition is determined to be false.
Shown below is the general form of a typical decision-making structure found in most of the programming languages:
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
this slide is for to understand the conditions which are applied in C++ programming language. I hope u would understand better by viewing this presentation.
Decision making in C. Decision making is about deciding the order of execution of statements based on certain conditions or repeat a group of statements until certain specified conditions are met. C language handles decision-making by supporting the following statements, if statement.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
2. Program..
Sequence of instructions written for specific purpose
Like program to find out factorial of number
Can be written in higher level programming languages that
human can understandhuman can understand
Those programs are translated to computer understandable
languages
Task will be done by special tool called compiler
Version_Sep_2013
C
SharpC
ode.org
3. Compiler will convert higher level language code to lower
language code like binary code
Most prior programming language was ‘C’
Rules & format that should be followed while writingRules & format that should be followed while writing
program are called syntax
Consider program to print “Hello!” on screen
Version_Sep_2013
C
SharpC
ode.org
4. void main()
{
printf(“Hello!”);
}}
Void main(), function and entry point of compilation
Part within two curly brackets, is body of function
Printf(), function to print sequence of characters on screen
Version_Sep_2013
C
SharpC
ode.org
5. Any programming language having three part
1. Data types
2. Keywords
3. Operators3. Operators
Data types are like int, float, double
Keyword are like printf, main, if, else
The words that are pre-defined for compiler are keyword
Keywords can not be used to define variable
Version_Sep_2013
C
SharpC
ode.org
6. We can define variable of data type
Like int a; then ‘a’ will hold value of type int and is called
variable
Programs can have different type of statements likePrograms can have different type of statements like
conditional statements and looping statements
Conditional statements are for checking some condition
Version_Sep_2013
C
SharpC
ode.org
7. Conditional Statements…
Conditional statements controls the sequence of
statements, depending on the condition
Relational operators allow comparing two values.
1. == is equal to1. == is equal to
2. != not equal to
3. < less than
4. > greater than
5. <= less than or equal to
6. >= greater than or equal to
Version_Sep_2013
C
SharpC
ode.org
8. SIMPLE IF STATEMENT
It execute if condition is TRUE
Syntax:
if(condition)
{{
Statement1;
.....
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
9. main()
{
int a,b;
printf(“Enter a,b values:”);
scanf(“%d %d”,&a,&b);
if(a>b) {
printf(“n a is greater than b”); }printf(“n a is greater than b”); }
}
OUTPUT:
Enter a,b values:20 10
a is greater than b
Version_Sep_2013
C
SharpC
ode.org
10. IF-ELSE STATEMENT
It execute IF condition is TRUE.IF condition is FLASE it execute ELSE part
Syntax:
if(condition)
{
Statement1;Statement1;
.....
Statement n;
}
else
{
Statement1;
.....
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
11. main()
{
int a,b;
printf(“Enter a,b values:”);
scanf(“%d %d”,&a,&b);
if(a>b) {
printf(“n a is greater than b”); }
else {else {
printf(“nb is greater than b”); }
}
OUTPUT:
Enter a,b values:10 20
b is greater than a
Version_Sep_2013
C
SharpC
ode.org
12. IF-ELSE IF STATEMENT:
It execute IF condition is TRUE.IF condition is FLASE it checks ELSE IF part
.ELSE IF is true then execute ELSE IF PART. This is also false it goes to ELSE
part.
Syntax:
if(condition)
{
Statementn;Statementn;
}
else if(condition)
{
Statementn;
}
else
{
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
13. main()
{
int a,b;
printf(“Enter a,b values:”);
scanf(“%d %d”,&a,&b);
if(a>b) {
printf(“n a is greater than b”); }
else if(b>a) {else if(b>a) {
printf(“nb is greater than b”); }
else {
printf(“n a is equal to b”); }
}
OUTPUT:
Enter a,b values:10 10
a is equal to b
Version_Sep_2013
C
SharpC
ode.org
14. NESTED IF STATEMENT
To check one conditoin within another.
Take care of brace brackets within the conditions.
Synatax:
if(condition)
{{
if(condition)
{
Statement n;
}
}
else
{
Statement n;
}
Version_Sep_2013
C
SharpC
ode.org
15. main()
{
int a,b;
printf(“n Enter a and b values:”);
scanf(“%d %d ”,&a,&b);
if(a>b) {
if((a!=0) && (b!=0)) {
printf(“na and b both are +ve and a >b); }
else {else {
printf(“n a is greater than b only”) ; } }
else {
printf(“ na is less than b”); }
}
Output:
Enter a and b values:30 20
a and b both are +ve and a > b
Version_Sep_2013
C
SharpC
ode.org
16. Switch..case
The switch statement is much like a nested if .. else statement.
switch statement can be slightly more efficient and easier to read.
Syntax :
switch( expression )
{
case constant-expression1:case constant-expression1:
statements1; break;
case constant-expression2:
statements2; break
default :
statements4; break;
}
Version_Sep_2013
C
SharpC
ode.org
17. main()
{
char Grade = ‘B’;
switch( Grade )
{
case 'A' :
printf( "Excellentn" ); break;
case 'B' :
printf( "Goodn" ); break;
case 'C' :case 'C' :
printf( "OKn" ); break;
case 'D' :
printf( "Mmmmm....n" ); break;
default :
printf( "What is your grade anyway?" );
break;
}
}
Version_Sep_2013
C
SharpC
ode.org
18. Looping…
Loops provide a way to repeat commands and control how many
times they are repeated.
C provides a number of looping way.
while loopwhile loop
A while statement is like a repeating if statement.
Like an If statement, if the test condition is true: the statements
get executed.
The difference is that after the statements have been executed,
the test condition is checked again.
If it is still true the statements get executed again.
This cycle repeats until the test condition evaluates to false.
Version_Sep_2013
C
SharpC
ode.org
19. Basic syntax of while loop is as follows:
while ( expression )
{
Single statement or Block of statements;Single statement or Block of statements;
}
Will check for expression, until its true when it gets false
execution will be stop
Version_Sep_2013
C
SharpC
ode.org
20. main()
{
int i = 5;
while ( i > 0 ) {
printf("Hello %dn", i );
i = i -1; }
}}
Output
Hello 5
Hello 4
Hello 3
Hello 2
Hello 1
Version_Sep_2013
C
SharpC
ode.org
21. Do..While
do ... while is just like a while loop except that the test
condition is checked at the end of the loop rather than the
start.
This has the effect that the content of the loop are alwaysThis has the effect that the content of the loop are always
executed at least once.
Basic syntax of do...while loop is as follows:
do {
Single statement or Block of statements; }
while(expression);
Version_Sep_2013
C
SharpC
ode.org
22. main()
{
int i = 5;
do{
printf("Hello %dn", i );
i = i -1; }
while ( i > 0 );
}}
Output
Hello 5
Hello 4
Hello 3
Hello 2
Hello 1
Version_Sep_2013
C
SharpC
ode.org
23. For Loop…
for loop is similar to while, it's just written differently. for
statements are often used to proccess lists such a range of
numbers:
Basic syntax of for loop is as follows:Basic syntax of for loop is as follows:
for( initialization; condition; increment)
{ Single statement or Block of statements;
}
Version_Sep_2013
C
SharpC
ode.org
24. main()
{
int i; int j = 5;
for( i = 0; i <= j; i ++ )
{
printf("Hello %dn", i );
}
}}
Output
Hello 0
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
Version_Sep_2013
C
SharpC
ode.org
25. Break & Continue…
C provides two commands to control how we loop:
break -- exit form loop or switch.
continue -- skip 1 iteration of loop.
Break is used with switch caseBreak is used with switch case
Version_Sep_2013
C
SharpC
ode.org
26. main()
{
int i; int j = 5;
for( i = 0; i <= j; i ++ ) {
if( i == 3 )
{
break;
}}
printf("Hello %dn", i ); }
}
Output
Hello 0
Hello 1
Hello 2
Version_Sep_2013
C
SharpC
ode.org
27. Continue Example..
main()
{
int i; int j = 5;
for( i = 0; i <= j; i ++ )
{
if( i == 3 )
{{
continue;
}
printf("Hello %dn", i );
}
}
Output
Hello 0
Hello 1
Hello 2
Hello 4
Hello 5 Version_Sep_2013
C
SharpC
ode.org
28. Functions…
A function is a module or block of program code which
deals with a particular task.
Making functions is a way of isolating one block of code
from other independent blocks of code.from other independent blocks of code.
Functions serve two purposes.
1. They allow a programmer to say: `this piece of code does a
specific job which stands by itself and should not be mixed
up with anything else',
2. Second they make a block of code reusable since a function
can be reused in many different contexts without repeating
parts of the program text.
Version_Sep_2013
C
SharpC
ode.org
29. int add( int p1, int p2 ); //function declaration
void main()
{
int a = 10;
int b = 20, c;
c = add(a,b); //call to function
printf(“Addition is : %d”, c);printf(“Addition is : %d”, c);
}
int add( int p1, int p2 ) //function definition
{
return (p1+p2);
}
Version_Sep_2013
C
SharpC
ode.org
30. Exercise…
1. Find out factorial of given number
2. Check whether given number is prime number or not
3. Check whether given number is Armstrong number or
notnot
4. Calculate some of first 100 even numbers
5. Prepare calculator using switch
Version_Sep_2013
C
SharpC
ode.org