SlideShare a Scribd company logo
Introduction of a C Program
Md. Alamgir Hossain
Lecturer
Dept. of CSE, Prime University
Mail: alamgir.cse14.just@gmail.com
Our first C program
Which part is used for why??
#include <stdio.h> includes the standard input output library functions. The
printf() function is defined in stdio.h .
int main(); The main() function is the entry point of every program in c language.
printf(); The printf() function is used to print data on the console.
return 0; The return 0 statement, returns execution status to the OS. The 0 value is
used for successful execution and 1 for unsuccessful execution.
Variable in C
A variable is a name of the memory location. It is used to store data. Its value can
be changed, and it can be reused many times.
It is a way to represent memory location through symbol so that it can be easily
identified.
Let's see the syntax to declare a variable: type variable_list;
The example of declaring the variable is given below:
int a;
float b;
char c;
Here, a, b, c are variables. The int, float, char are the data types.
Variable in C
We can also provide values while declaring the variables as given below:
int a =10, b = 20; //declaring 2 variable of integer type
float f = 20.8;
char c = 'A';
Rules for defining variables
A variable can have alphabets, digits, and underscore.
A variable name can start with the alphabet, and underscore only. It can't start
with a digit. Not allow: int 9a;
No whitespace is allowed within the variable name. Not Allow: int ab cd;
A variable name must not be any reserved word or keyword, e.g. int, float, etc.
Valid variable names: int a; int _ab; int a30;
Invalid variable names: int 2; int a b; int long;
Basic Data Types Size and Range in C
Basic Data Type: int, char, float, double
Data Types Memory Size Range
char 1 byte -128 to 127{-(2
n-1
-1) to (2
n-1
)}
int 2 byte −32,768 to 32,767
float 4 byte
double 8 byte
Format Specifier in C
The Format specifier is a string used in the formatted input and output functions.
The format string determines the format of the input and output. The format string
always starts with a '%' character.
The commonly used format specifiers in printf() and Scanf() function are:
Format
specifier
Description
%d It is used to print the integer value.
%f It is used for printing the decimal floating-point values. By default,
it prints the 6 values after '.'.
%c It is used to print the unsigned character.
%lf Double Value
Printing Integer value in C
Printing Character value in C
Printing Float and Double value in C
Thank You
Ad

More Related Content

What's hot (20)

Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Sabik T S
 
Lab 1
Lab 1Lab 1
Lab 1
emailharmeet
 
Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
Sabik T S
 
CP Handout#10
CP Handout#10CP Handout#10
CP Handout#10
trupti1976
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory Concept
Deepak Singh
 
CP Handout#6
CP Handout#6CP Handout#6
CP Handout#6
trupti1976
 
7. input and output functions
7. input and output functions7. input and output functions
7. input and output functions
Way2itech
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
Muthuganesh S
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
Md Masudur Rahman
 
First c program
First c programFirst c program
First c program
Komal Pardeshi
 
CP Handout#5
CP Handout#5CP Handout#5
CP Handout#5
trupti1976
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
Dr. SURBHI SAROHA
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
Kamal Acharya
 
C- Programming Assignment 3
C- Programming Assignment 3C- Programming Assignment 3
C- Programming Assignment 3
Animesh Chaturvedi
 
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
niyamathShariff
 
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)
Dr. SURBHI SAROHA
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
Abhishek Sinha
 
Operators
OperatorsOperators
Operators
Allah Ditta
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
Aditya Vaishampayan
 
Write a program that accepts percentage from the user and displays its grade ...
Write a program that accepts percentage from the user and displays its grade ...Write a program that accepts percentage from the user and displays its grade ...
Write a program that accepts percentage from the user and displays its grade ...
Farwa Aqeel
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Sabik T S
 
Data Input and Output
Data Input and OutputData Input and Output
Data Input and Output
Sabik T S
 
Chapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory ConceptChapter 3 - Variable Memory Concept
Chapter 3 - Variable Memory Concept
Deepak Singh
 
7. input and output functions
7. input and output functions7. input and output functions
7. input and output functions
Way2itech
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
Muthuganesh S
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
Kamal Acharya
 
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
niyamathShariff
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
Abhishek Sinha
 
Write a program that accepts percentage from the user and displays its grade ...
Write a program that accepts percentage from the user and displays its grade ...Write a program that accepts percentage from the user and displays its grade ...
Write a program that accepts percentage from the user and displays its grade ...
Farwa Aqeel
 

Similar to 2. introduction of a c program (20)

Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
MOHAMAD NOH AHMAD
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptx
vijayapraba1
 
Unit 2- Module 2.pptx
Unit 2- Module 2.pptxUnit 2- Module 2.pptx
Unit 2- Module 2.pptx
simranjotsingh2908
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
 
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptxPPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
ZwecklosSe
 
Programming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOTProgramming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOT
jagmeetsidhu0012
 
basic C PROGRAMMING for first years .pptx
basic C  PROGRAMMING for first years  .pptxbasic C  PROGRAMMING for first years  .pptx
basic C PROGRAMMING for first years .pptx
divyasindhu040
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
Likhil181
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdf
SergiuMatei7
 
programming concepts with c ++..........
programming concepts with c ++..........programming concepts with c ++..........
programming concepts with c ++..........
anjanasharma77573
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
KrishanPalSingh39
 
C tutorial
C tutorialC tutorial
C tutorial
Chukka Nikhil Chakravarthy
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
kiranrajat
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
fds unit1.docx
fds unit1.docxfds unit1.docx
fds unit1.docx
AzhagesvaranTamilsel
 
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
4 Introduction to C.pptxSSSSSSSSSSSSSSSS4 Introduction to C.pptxSSSSSSSSSSSSSSSS
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
EG20910848921ISAACDU
 
Chapter3
Chapter3Chapter3
Chapter3
Kamran
 
Week 02_Development Environment of C++.pdf
Week 02_Development Environment of C++.pdfWeek 02_Development Environment of C++.pdf
Week 02_Development Environment of C++.pdf
salmankhizar3
 
Presentation on 21.11.2022.pptx
Presentation on 21.11.2022.pptxPresentation on 21.11.2022.pptx
Presentation on 21.11.2022.pptx
Priyajit Sen
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
JAYA
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
MOHAMAD NOH AHMAD
 
Fundamentals of Programming Constructs.pptx
Fundamentals of  Programming Constructs.pptxFundamentals of  Programming Constructs.pptx
Fundamentals of Programming Constructs.pptx
vijayapraba1
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
Mahira Banu
 
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptxPPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
PPS_unit_2_gtu_sem_2_year_2023_GTUU.pptx
ZwecklosSe
 
Programming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOTProgramming_in_C_language_Unit5.pptx course ATOT
Programming_in_C_language_Unit5.pptx course ATOT
jagmeetsidhu0012
 
basic C PROGRAMMING for first years .pptx
basic C  PROGRAMMING for first years  .pptxbasic C  PROGRAMMING for first years  .pptx
basic C PROGRAMMING for first years .pptx
divyasindhu040
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
Likhil181
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdf
SergiuMatei7
 
programming concepts with c ++..........
programming concepts with c ++..........programming concepts with c ++..........
programming concepts with c ++..........
anjanasharma77573
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
KrishanPalSingh39
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
kiranrajat
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
4 Introduction to C.pptxSSSSSSSSSSSSSSSS4 Introduction to C.pptxSSSSSSSSSSSSSSSS
4 Introduction to C.pptxSSSSSSSSSSSSSSSS
EG20910848921ISAACDU
 
Chapter3
Chapter3Chapter3
Chapter3
Kamran
 
Week 02_Development Environment of C++.pdf
Week 02_Development Environment of C++.pdfWeek 02_Development Environment of C++.pdf
Week 02_Development Environment of C++.pdf
salmankhizar3
 
Presentation on 21.11.2022.pptx
Presentation on 21.11.2022.pptxPresentation on 21.11.2022.pptx
Presentation on 21.11.2022.pptx
Priyajit Sen
 
Ad

More from Alamgir Hossain (12)

How to write a project proposal for software engineering course
How to write a project proposal for software engineering courseHow to write a project proposal for software engineering course
How to write a project proposal for software engineering course
Alamgir Hossain
 
Malware Detection Approaches using Data Mining Techniques.pptx
Malware Detection Approaches using Data Mining Techniques.pptxMalware Detection Approaches using Data Mining Techniques.pptx
Malware Detection Approaches using Data Mining Techniques.pptx
Alamgir Hossain
 
5 nested if in c with proper example
5 nested if in c with proper example5 nested if in c with proper example
5 nested if in c with proper example
Alamgir Hossain
 
4. decision making and some basic problem
4. decision making and some basic problem4. decision making and some basic problem
4. decision making and some basic problem
Alamgir Hossain
 
1. importance of c
1. importance of c1. importance of c
1. importance of c
Alamgir Hossain
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
Alamgir Hossain
 
Report on student-faculty document sharing android project
Report on student-faculty document sharing android projectReport on student-faculty document sharing android project
Report on student-faculty document sharing android project
Alamgir Hossain
 
A lab report on modeling and simulation with python code
A lab report on modeling and simulation with python codeA lab report on modeling and simulation with python code
A lab report on modeling and simulation with python code
Alamgir Hossain
 
Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...
Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...
Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...
Alamgir Hossain
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.
Alamgir Hossain
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
Alamgir Hossain
 
Microsoft Teams
Microsoft TeamsMicrosoft Teams
Microsoft Teams
Alamgir Hossain
 
How to write a project proposal for software engineering course
How to write a project proposal for software engineering courseHow to write a project proposal for software engineering course
How to write a project proposal for software engineering course
Alamgir Hossain
 
Malware Detection Approaches using Data Mining Techniques.pptx
Malware Detection Approaches using Data Mining Techniques.pptxMalware Detection Approaches using Data Mining Techniques.pptx
Malware Detection Approaches using Data Mining Techniques.pptx
Alamgir Hossain
 
5 nested if in c with proper example
5 nested if in c with proper example5 nested if in c with proper example
5 nested if in c with proper example
Alamgir Hossain
 
4. decision making and some basic problem
4. decision making and some basic problem4. decision making and some basic problem
4. decision making and some basic problem
Alamgir Hossain
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
Alamgir Hossain
 
Report on student-faculty document sharing android project
Report on student-faculty document sharing android projectReport on student-faculty document sharing android project
Report on student-faculty document sharing android project
Alamgir Hossain
 
A lab report on modeling and simulation with python code
A lab report on modeling and simulation with python codeA lab report on modeling and simulation with python code
A lab report on modeling and simulation with python code
Alamgir Hossain
 
Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...
Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...
Lab report on to plot efficiency of pure and slotted aloha in matlab a data c...
Alamgir Hossain
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.
Alamgir Hossain
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
Alamgir Hossain
 
Ad

Recently uploaded (20)

U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM & Mia eStudios
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM & Mia eStudios
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 

2. introduction of a c program

  • 1. Introduction of a C Program Md. Alamgir Hossain Lecturer Dept. of CSE, Prime University Mail: alamgir.cse14.just@gmail.com
  • 2. Our first C program
  • 3. Which part is used for why?? #include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h . int main(); The main() function is the entry point of every program in c language. printf(); The printf() function is used to print data on the console. return 0; The return 0 statement, returns execution status to the OS. The 0 value is used for successful execution and 1 for unsuccessful execution.
  • 4. Variable in C A variable is a name of the memory location. It is used to store data. Its value can be changed, and it can be reused many times. It is a way to represent memory location through symbol so that it can be easily identified. Let's see the syntax to declare a variable: type variable_list; The example of declaring the variable is given below: int a; float b; char c; Here, a, b, c are variables. The int, float, char are the data types.
  • 5. Variable in C We can also provide values while declaring the variables as given below: int a =10, b = 20; //declaring 2 variable of integer type float f = 20.8; char c = 'A'; Rules for defining variables A variable can have alphabets, digits, and underscore. A variable name can start with the alphabet, and underscore only. It can't start with a digit. Not allow: int 9a; No whitespace is allowed within the variable name. Not Allow: int ab cd; A variable name must not be any reserved word or keyword, e.g. int, float, etc. Valid variable names: int a; int _ab; int a30; Invalid variable names: int 2; int a b; int long;
  • 6. Basic Data Types Size and Range in C Basic Data Type: int, char, float, double Data Types Memory Size Range char 1 byte -128 to 127{-(2 n-1 -1) to (2 n-1 )} int 2 byte −32,768 to 32,767 float 4 byte double 8 byte
  • 7. Format Specifier in C The Format specifier is a string used in the formatted input and output functions. The format string determines the format of the input and output. The format string always starts with a '%' character. The commonly used format specifiers in printf() and Scanf() function are: Format specifier Description %d It is used to print the integer value. %f It is used for printing the decimal floating-point values. By default, it prints the 6 values after '.'. %c It is used to print the unsigned character. %lf Double Value
  • 10. Printing Float and Double value in C
  翻译: