SlideShare a Scribd company logo
Fundamental structure
of programming in 'c'
Presented by:
Mr. Yogesh Kumar
M.Sc. I Sem.(Bioinformatics)
‘C’ language is simple as compare to the English language
Here is steps comparison…
Steps in learning English language
Steps in learning ‘c’
alphabets words sentences paragraph
Alphabets , digits
Special symbols
Constants,
variables
keywords
instructi
ons
program
Before planning a program we need to define its logic
(the correct sequence of instructions need to solve the
problem at hand).the term algorithm is often used to
refer to the logic of a program.
It is a step by step description of how to arrive at the
solution of the given problem.(exp..)
*Write a program to find the larger of two given numbers.
Algorithm.
1.Input two numbers a and b
2.Assign big=a
3. If (b>big)the big=b
4.Output big
5.stop
 Flowchart is the diagrammatic representation of
programs and algorithm . it is generally used to
understand the program and to solve the program
 It uses boxes of different shapes to denote different
types of instructions.
 The process of drawing a flowchart for an algorithm is
often referred to flowcharting
Only a few symbols are needed to indicate the necessary
operations in a flowchart. These basic flowchart symbols
have been standardized by the American National
standards institute (ANSI).
As shown……
flow lines
connector
start processing Input/output
decision
example.1
no
yes
start
Read
num
i=1
Is
i<=10
Write
(i*num)
i=i+1
stop
Tokens in ‘c’
 The alphabets ,numbers and special symbols when
properly combined form constants , variables &
keywords
 Alphabets A,B,C………..Z
a , b, c ……....z
 Digits 0,1,2,3……….9
 Special symbols ~, ’, !, @, #, %, ^, &, =,|,?, /,
[ ] : ; ””,’ <> ., { }
Constant, variables & keywords
3
5
PRIMARY CONSTANT
 Integer constant
 Real constant
 Character constant
 Array
 Pointer
 Structure
 Union
 Enum.etc
SECONDARY CONSTANT
As we saw earlier , an entity that may vary during program
execution is called a variable.
 Type of variable used in program depend on the type of
constant stored in it.
 Float/real, integer ,or character constant
 Variable name are name given to locations in memory
Exp….
float=6.0 (4 byte)
Int =6 (2 byte)
char=‘a’ (1 byte)
 Keywords are the words whose meaning has already been
explained to the c compiler
 The keywords cannot be used as variable name if we do so,
we are typing to assign new value to keywords which is not
allowed by compiler
 There are 32 keywords available in c
 Some are …….
short return double switch register signed
long void float union static unsigned
int break if goto continue volatile
char default for do sizeof enum
else case while auto extern typedef ..etc
• structure
•class
• integer
• float
•Character (char)
•int %d
•float %f
•char %c
•Array
•Pointer
•Function
•String
DATA TYPES
User define data type Fundamental data type Derived data type
Arithmetic operators
+
-
*
/
%
purpose
Addition
Subtraction
Multiplication
Division
Remainder after
division
example
7+5=12
7-5=2
7*5=35
8/2=4
7%5=2
ARITHMETIC OPERATORS
&& Means logical AND
|| Means logical OR
! Means logical NOT
LOGICAL OPERATOR
RELATIONAL OPERATORS
> Means greater than
< Means less than
== Means equal to
>= Means greater than equal to
<= Means less than equal to
!= Means not equals to
 The general form of if statement is
if ( condition)
{
Statement-block
}
If condition is true the statement block will executed
otherwise the statement block will skipped.
#include<stdio.h>
#include<conio.h>
void main()
{
float a,b,big;
printf(“enter two numbersn”);
scanf(“%f%f”,&a,&b);
big=a;
if(b>big) big=b;
printf(“larger number is:%f”,big);
}
RUN
Enter two numbers
12.5 45.0
Larger number is 45.0
ENTER
false
true
next statement
condition
Statement-block
if (condition)
{
statement-1;
}
else
{
statement-2;
}
enter
false true
next statement
Condition
?
Statement-1
Statement-2
The switch statement test the value of given expression
against a list of case values
General form
switch(expression)
{
case val-1:
statement-1
break;
case val-2:
statement-2;
break;
default:
default-statement;
break;
#include<stdio.h>
#include<conio.h>
void main()
{
char grade;
switch(grade)
{
case ‘A’:
printf(“passed with first division”);
break;
case ‘B’:
printf(“passed with second division”);
break;
case ‘C’:
printf(“conditional pass”;
break;
default:
printf(“fail”);
break;
}
getch();
}
 There are two types of repetitive structures
1. Conditional controlled (in this body is repetitively
executed until the given condition become true)
a) while statement
b) do while statement
2. Counter controlled (in this the number of time the set of
statement is executed ex.. )For loop
a) while statement
while(condition)
{
Statement(s);
}
1. evaluate the condition.
2. If the condition true then execute the statement(s)and repeat step 1.
3. If the condition is false then the control is transferred out of loop.
Exp…..
#include<stdio.h>
main()
{
int num=1,s=0;
While(num<=10)
{
sum +=num;
num+1=1;
}
printf(“sum of first 10 natural numbers : %d ”, s);
getch();
}
RUN
Sum of first 10 natural num is : 55
The sequence of operation in while loop
no
yes
start
Read
num
i=1
Is
i<=10
Write
(i*num)
i=i+1
stop
In while statement, condition is evaluated first. Therefore
the body of loop may not be executed at all if condition
is not satisfied at the very first attempt. But in do loop,
condition is evaluated at the end. Therefore the body of
the loop is executed at lest once in this statement
The general form of this statement is..
do
{
Statement(s);
}
while (condition);
printf(“…………….”);
}
Do while statement
#include<stdio.>
main( )
{
int num=1,s=0;
do
{
s +=num;
num +=1;
}
while(num<=10);
printf(“sum of first natural no is %d”,s) ;
getch();
}
Run:
Sum of 10 natural number is 55.
(do while )..exp..sum of first 10 natural number
• The difference b/w. while & do while loop
I. In while the condition is tested before executing
body of loop. /In do while the condition is tested
after executing the body
II. Body of do loop is executed at lest once but body of
while loop may not be executed at all. /In while , If
initial the condition is not satisfied the loop will
to get executed even once
 There are situation where you want to have a
statement or group of statements to be executed
numbers of time and the number of repetition does
not depend on the condition but it is simply a
repetition up to a certain numbers. The best way of
repetition is a for loop. The general form of the loop
for single statement is:
for ( initialization ; condition ; increment)
{
statement(s);
}
#include<stdio.h>
main( )
{
int I,s=0;
for (i=1;1<=10;i++)
s=s+1;
printf(“sum of first natural number is:%d”,s);
getch( );
}
Run:
Sum of first 10 natural number is : 55
Loop construct can be nested or embedded within one
another. The inner loop must be completely embedded
with the outer loop . There should no overlapping of loops.
**Demonstration of nested loops**
#include<stdio.h>
void main()
{
int r,c,sum;
for (r=1;r<=3;r++) /*outer loop*/
{
for(c=1;c<=2;c++) /*inner loop*/
{
sum=r+c;
printf(“r=%d c=%d sum=%dn”,r,c,sum);
}}
getch();
}
Output
r=1 c=1 sum=2
r=1 c=2 sum=3
r=2 c=1 sum=3
r=2 c=2 sum=4
The loop that we have used so far executed the statements within them a finite number of
times. However, in real life programming, one comes across a situation when it is not
known beforehand how many times the statements in the loop are to be executed. This
situation can be programmed as shown below:
/* execution of a loop an unknown number of times*/
#include<stdio.h>
void main()
{
Char another;
Int num;
do
{
printf(“enter a number”);
scanf(“%d”,&num);
printf(“square of%d is %d”, num, num*num);
Printf(“n want to enter another number y/n”);
Scanf(“%c”,&another);
}while(another==‘y’);
}
getch();
}
Output
Enter a number 5
Square of 5 is 25
Want to enter another number y/n y
Enter a number 7
Square of 7 is 49
Want to enter anotehr number y/n n
THANK YOU ……. .
Claguage 110226222227-phpapp02

More Related Content

What's hot

Control structures in c
Control structures in cControl structures in c
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and Functions
DhivyaSubramaniyam
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
Shaina Arora
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi4
 
Control Structures: Part 1
Control Structures: Part 1Control Structures: Part 1
Control Structures: Part 1
Andy Juan Sarango Veliz
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
Sowmya Jyothi
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.com
Green Ecosystem
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
tanmaymodi4
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
Sokngim Sa
 
Decision making statements in C programming
Decision making statements in C programmingDecision making statements in C programming
Decision making statements in C programming
Rabin BK
 
Control Structures
Control StructuresControl Structures
Control Structures
Ghaffar Khan
 
Control structures in C
Control structures in CControl structures in C
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
narmadhakin
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
vinay arora
 
Programming C Language
Programming C LanguageProgramming C Language
Programming C Language
natarafonseca
 
Lecture 9- Control Structures 1
Lecture 9- Control Structures 1Lecture 9- Control Structures 1
Lecture 9- Control Structures 1
Md. Imran Hossain Showrov
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
Tarun Sharma
 
Ch6 Loops
Ch6 LoopsCh6 Loops
Ch6 Loops
SzeChingChen
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
Md. Imran Hossain Showrov
 

What's hot (19)

Control structures in c
Control structures in cControl structures in c
Control structures in c
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and Functions
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Control Structures: Part 1
Control Structures: Part 1Control Structures: Part 1
Control Structures: Part 1
 
Unit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in CUnit ii chapter 2 Decision making and Branching in C
Unit ii chapter 2 Decision making and Branching in C
 
Learning C programming - from lynxbee.com
Learning C programming - from lynxbee.comLearning C programming - from lynxbee.com
Learning C programming - from lynxbee.com
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Decision making statements in C programming
Decision making statements in C programmingDecision making statements in C programming
Decision making statements in C programming
 
Control Structures
Control StructuresControl Structures
Control Structures
 
Control structures in C
Control structures in CControl structures in C
Control structures in C
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
C Prog. - Decision & Loop Controls
C Prog. - Decision & Loop ControlsC Prog. - Decision & Loop Controls
C Prog. - Decision & Loop Controls
 
Programming C Language
Programming C LanguageProgramming C Language
Programming C Language
 
Lecture 9- Control Structures 1
Lecture 9- Control Structures 1Lecture 9- Control Structures 1
Lecture 9- Control Structures 1
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Ch6 Loops
Ch6 LoopsCh6 Loops
Ch6 Loops
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 

Similar to Claguage 110226222227-phpapp02

C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
 
What is c
What is cWhat is c
What is c
Nitesh Saitwal
 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan Kumari
THE NORTHCAP UNIVERSITY
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
AnkitaVerma776806
 
C tutorial
C tutorialC tutorial
C tutorial
Anurag Sukhija
 
C operators
C operatorsC operators
C operators
srmohan06
 
C fundamental
C fundamentalC fundamental
C fundamental
Selvam Edwin
 
Programming in C
Programming in CProgramming in C
Programming in C
Nishant Munjal
 
Dr Mrs A A Miraje C Programming PPT.pptx
Dr Mrs A A Miraje C Programming PPT.pptxDr Mrs A A Miraje C Programming PPT.pptx
Dr Mrs A A Miraje C Programming PPT.pptx
ProfAAMiraje
 
C Programming Unit-2
C Programming Unit-2C Programming Unit-2
C Programming Unit-2
Vikram Nandini
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
Tanmay Modi
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
tanmaymodi4
 
[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
yasir_cesc
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
sachindane
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
sana shaikh
 
C notes for exam preparation
C notes for exam preparationC notes for exam preparation
C notes for exam preparation
Lakshmi Sarvani Videla
 
What is c
What is cWhat is c
What is c
pacatarpit
 
Elements of programming
Elements of programmingElements of programming
Lập trình C
Lập trình CLập trình C
Lập trình C
Viet NguyenHoang
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
C++ Homework Help
 

Similar to Claguage 110226222227-phpapp02 (20)

C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
What is c
What is cWhat is c
What is c
 
Fundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan KumariFundamentals of computer programming by Dr. A. Charan Kumari
Fundamentals of computer programming by Dr. A. Charan Kumari
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 
C tutorial
C tutorialC tutorial
C tutorial
 
C operators
C operatorsC operators
C operators
 
C fundamental
C fundamentalC fundamental
C fundamental
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Dr Mrs A A Miraje C Programming PPT.pptx
Dr Mrs A A Miraje C Programming PPT.pptxDr Mrs A A Miraje C Programming PPT.pptx
Dr Mrs A A Miraje C Programming PPT.pptx
 
C Programming Unit-2
C Programming Unit-2C Programming Unit-2
C Programming Unit-2
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
Loops in c language
Loops in c languageLoops in c language
Loops in c language
 
[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
 
C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
 
C notes for exam preparation
C notes for exam preparationC notes for exam preparation
C notes for exam preparation
 
What is c
What is cWhat is c
What is c
 
Elements of programming
Elements of programmingElements of programming
Elements of programming
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 

Recently uploaded

如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
AnkitaPandya11
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 

Recently uploaded (20)

如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 

Claguage 110226222227-phpapp02

  • 1. Fundamental structure of programming in 'c' Presented by: Mr. Yogesh Kumar M.Sc. I Sem.(Bioinformatics)
  • 2. ‘C’ language is simple as compare to the English language Here is steps comparison… Steps in learning English language Steps in learning ‘c’ alphabets words sentences paragraph Alphabets , digits Special symbols Constants, variables keywords instructi ons program
  • 3. Before planning a program we need to define its logic (the correct sequence of instructions need to solve the problem at hand).the term algorithm is often used to refer to the logic of a program. It is a step by step description of how to arrive at the solution of the given problem.(exp..) *Write a program to find the larger of two given numbers. Algorithm. 1.Input two numbers a and b 2.Assign big=a 3. If (b>big)the big=b 4.Output big 5.stop
  • 4.  Flowchart is the diagrammatic representation of programs and algorithm . it is generally used to understand the program and to solve the program  It uses boxes of different shapes to denote different types of instructions.  The process of drawing a flowchart for an algorithm is often referred to flowcharting
  • 5. Only a few symbols are needed to indicate the necessary operations in a flowchart. These basic flowchart symbols have been standardized by the American National standards institute (ANSI). As shown…… flow lines connector start processing Input/output decision
  • 8.  The alphabets ,numbers and special symbols when properly combined form constants , variables & keywords  Alphabets A,B,C………..Z a , b, c ……....z  Digits 0,1,2,3……….9  Special symbols ~, ’, !, @, #, %, ^, &, =,|,?, /, [ ] : ; ””,’ <> ., { } Constant, variables & keywords
  • 9. 3 5
  • 10. PRIMARY CONSTANT  Integer constant  Real constant  Character constant  Array  Pointer  Structure  Union  Enum.etc SECONDARY CONSTANT
  • 11. As we saw earlier , an entity that may vary during program execution is called a variable.  Type of variable used in program depend on the type of constant stored in it.  Float/real, integer ,or character constant  Variable name are name given to locations in memory Exp…. float=6.0 (4 byte) Int =6 (2 byte) char=‘a’ (1 byte)
  • 12.  Keywords are the words whose meaning has already been explained to the c compiler  The keywords cannot be used as variable name if we do so, we are typing to assign new value to keywords which is not allowed by compiler  There are 32 keywords available in c  Some are ……. short return double switch register signed long void float union static unsigned int break if goto continue volatile char default for do sizeof enum else case while auto extern typedef ..etc
  • 13. • structure •class • integer • float •Character (char) •int %d •float %f •char %c •Array •Pointer •Function •String DATA TYPES User define data type Fundamental data type Derived data type
  • 14.
  • 16. && Means logical AND || Means logical OR ! Means logical NOT LOGICAL OPERATOR
  • 17. RELATIONAL OPERATORS > Means greater than < Means less than == Means equal to >= Means greater than equal to <= Means less than equal to != Means not equals to
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.  The general form of if statement is if ( condition) { Statement-block } If condition is true the statement block will executed otherwise the statement block will skipped.
  • 23. #include<stdio.h> #include<conio.h> void main() { float a,b,big; printf(“enter two numbersn”); scanf(“%f%f”,&a,&b); big=a; if(b>big) big=b; printf(“larger number is:%f”,big); } RUN Enter two numbers 12.5 45.0 Larger number is 45.0
  • 27. The switch statement test the value of given expression against a list of case values General form switch(expression) { case val-1: statement-1 break; case val-2: statement-2; break; default: default-statement; break;
  • 28. #include<stdio.h> #include<conio.h> void main() { char grade; switch(grade) { case ‘A’: printf(“passed with first division”); break; case ‘B’: printf(“passed with second division”); break; case ‘C’: printf(“conditional pass”; break; default: printf(“fail”); break; } getch(); }
  • 29.  There are two types of repetitive structures 1. Conditional controlled (in this body is repetitively executed until the given condition become true) a) while statement b) do while statement 2. Counter controlled (in this the number of time the set of statement is executed ex.. )For loop a) while statement while(condition) { Statement(s); }
  • 30. 1. evaluate the condition. 2. If the condition true then execute the statement(s)and repeat step 1. 3. If the condition is false then the control is transferred out of loop. Exp….. #include<stdio.h> main() { int num=1,s=0; While(num<=10) { sum +=num; num+1=1; } printf(“sum of first 10 natural numbers : %d ”, s); getch(); } RUN Sum of first 10 natural num is : 55 The sequence of operation in while loop
  • 32. In while statement, condition is evaluated first. Therefore the body of loop may not be executed at all if condition is not satisfied at the very first attempt. But in do loop, condition is evaluated at the end. Therefore the body of the loop is executed at lest once in this statement The general form of this statement is.. do { Statement(s); } while (condition); printf(“…………….”); } Do while statement
  • 33. #include<stdio.> main( ) { int num=1,s=0; do { s +=num; num +=1; } while(num<=10); printf(“sum of first natural no is %d”,s) ; getch(); } Run: Sum of 10 natural number is 55. (do while )..exp..sum of first 10 natural number
  • 34. • The difference b/w. while & do while loop I. In while the condition is tested before executing body of loop. /In do while the condition is tested after executing the body II. Body of do loop is executed at lest once but body of while loop may not be executed at all. /In while , If initial the condition is not satisfied the loop will to get executed even once
  • 35.  There are situation where you want to have a statement or group of statements to be executed numbers of time and the number of repetition does not depend on the condition but it is simply a repetition up to a certain numbers. The best way of repetition is a for loop. The general form of the loop for single statement is: for ( initialization ; condition ; increment) { statement(s); }
  • 36. #include<stdio.h> main( ) { int I,s=0; for (i=1;1<=10;i++) s=s+1; printf(“sum of first natural number is:%d”,s); getch( ); } Run: Sum of first 10 natural number is : 55
  • 37. Loop construct can be nested or embedded within one another. The inner loop must be completely embedded with the outer loop . There should no overlapping of loops. **Demonstration of nested loops** #include<stdio.h> void main() { int r,c,sum; for (r=1;r<=3;r++) /*outer loop*/ { for(c=1;c<=2;c++) /*inner loop*/ { sum=r+c; printf(“r=%d c=%d sum=%dn”,r,c,sum); }} getch(); } Output r=1 c=1 sum=2 r=1 c=2 sum=3 r=2 c=1 sum=3 r=2 c=2 sum=4
  • 38. The loop that we have used so far executed the statements within them a finite number of times. However, in real life programming, one comes across a situation when it is not known beforehand how many times the statements in the loop are to be executed. This situation can be programmed as shown below: /* execution of a loop an unknown number of times*/ #include<stdio.h> void main() { Char another; Int num; do { printf(“enter a number”); scanf(“%d”,&num); printf(“square of%d is %d”, num, num*num); Printf(“n want to enter another number y/n”); Scanf(“%c”,&another); }while(another==‘y’); } getch(); } Output Enter a number 5 Square of 5 is 25 Want to enter another number y/n y Enter a number 7 Square of 7 is 49 Want to enter anotehr number y/n n