SlideShare a Scribd company logo
ONLINE CLASS
24 JAN 2024
COMPUTER PROGRAM
• A computer program is a sequence or set of instructions in a programming language for a computer
to execute. It is one component of software, which also includes documentation and other intangible
components.
C Language Programming Introduction Lecture
C Language Programming Introduction Lecture
C Language Programming Introduction Lecture
WRITE THE BASIC STRUCTURE OF C PROGRAMMING
LANGUAGE.
#include <stdio.h>
int main()
{
// Print Name
printf("Name : Alexandra Abramovn");
// Print Date of Birth
printf("DOB : July 14, 1975n");
// Print Mobile Number
printf("Mobile : 99-9999999999n");
// Indicate successful execution
return(0);
}
EXPLANATION
• #include <stdio.h>: This line includes the standard input-output library, which contains functions
for reading and writing data to and from the console.
• int main(): This is the main function of the program, where execution begins. It returns an integer
value, typically 0, to indicate successful execution.
• Inside the "main()" function, there are three printf statements. The "printf()" function is used to print
formatted text to the console. Each printf statement prints a line of text with specific information:
• printf ("Name : Alexandra Abramovn"); prints "Name : Alexandra Abramov" followed by a newline
character, which moves the cursor to the next line.
• printf ("DOB : July 14, 1975n"); prints "DOB : July 14, 1975" followed by a newline character.
• printf ("Mobile : 99-9999999999n"); prints "Mobile : 99-9999999999" followed by a newline character.
• return(0);: This line indicates the end of the main function and returns 0.
THINGS TO KNOW
• printf is used for displaying output with formatted strings.
• scanf is used for reading input with formatted strings.
• %d in scanf tells the program to expect an integer input
• i.e. %d is a way of telling the program to handle integer data when displaying output (with printf) or
when reading input (with scanf).
C is case sensitive. All commands in C must be lowercase.
EXAMPLE
WRITE A C PROGRAM TO INPUT TWO NUMBERS AND SHOW
ADDITION & SUBTRACTION.
#include <stdio.h>
int main()
{
int n1, n2;
printf("Enter First number: ");
scanf("%d", &n1);
printf("Enter Second number: ");
scanf("%d", &n2);
printf("Sum of Given Two Numbers =: %d n", n1+n2);
printf("Subtraction of Given Two Numbers =: %d n", n1-
n2);
printf("Product of Given Two Numbers =: %d n", n1*n2);
return 0;
}
WRITE A C PROGRAM TO INPUT TWO NUMBERS AND DIVIDE.
#include<stdio.h>
int main(){
int num1, num2, quotient;
//Asking for input
printf("Enter first number: ");
scanf("%d", &num1);
printf("Enter second number: ");
scanf("%d", &num2);
//Computing quotient
quotient = num1 / num2;
printf("Quotient: %d", quotient);
return 0;
}
WRITE A C PROGRAM TO SHOW THE SQUARE OF AN
INPUTTED NUMBER.
#include <stdio.h>
int main()
{
int number;
printf("Enter a number: ");
scanf("%d", &number);
printf("Square of Number is: %dn",
number*number);
return 0;
}
WRITE A C PROGRAM TO ASK A NUMBER INPUT FROM A USER
AND DETERMINE WHETHER THE NUM IS EVEN OR ODD.
#include <stdio.h>
int main()
{
int n;
printf("Enter A number: ");
scanf("%d", &n);
if (n % 2 == 0)
{
printf("%d is an even number.n", n);
}
else
{
printf("%d is an odd number.n", n);
}
return 0;
}
WRITE A C PROGRAM TO SHOW THE TABLE OF AN INPUTTED
NUMBER.
• #include <stdio.h>
• int main() {
• int number;
• // Input number from user
• printf("Enter a number: ");
• scanf("%d", &number);
• // Display multiplication table
• printf("Multiplication table for %d:n", number);
• for (int i = 1; i <= 10; ++i) {
• printf("%d x %d = %dn", number, i, number * i);
• }
• return 0;
• }
H.W
• Write a C program to compute the perimeter and area of a rectangle with a length of 7 inches and
width of 5 inches.
Expected Output:
Perimeter of the rectangle = 24 inches
Area of the rectangle = 35 square inches
• Write a C program to compute the perimeter and area of a circle with user input radius.
Expected Output Example:
Perimeter of the Circle = 37.680000 inches
Area of the Circle = 113.040001 square inches
• Write a C program to convert specified days into years, weeks and days.
Note: Ignore leap year.
Ad

Recommended

DOCX
Core programming in c
Rahul Pandit
 
PPTX
Introduction to Basic C programming 02
Wingston
 
DOCX
B.Com 1year Lab programs
Prasadu Peddi
 
PPTX
Unit-IV.pptx
Mehul Desai
 
DOC
Programming egs
Dr.Subha Krishna
 
DOCX
Chapter 1 Programming Fundamentals Assignment.docx
Shamshad
 
DOCX
C lab
rajni kaushal
 
DOCX
In C Programming create a program that converts a number from decimal.docx
tristans3
 
PPT
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
DOCX
Practical write a c program to reverse a given number
Mainak Sasmal
 
DOCX
Practical write a c program to reverse a given number
Mainak Sasmal
 
DOCX
Programming fundamentals
Zaibi Gondal
 
DOCX
C Programming
Sumant Diwakar
 
PDF
First c program
Komal Pardeshi
 
PPTX
Input and Output In C Language
Adnan Khan
 
DOCX
Best C Programming Solution
yogini sharma
 
DOCX
Write a program that reads in integer as many as the user enters from.docx
lez31palka
 
DOCX
C file
simarsimmygrewal
 
PPT
Functions in c
KavithaMuralidharan2
 
PPTX
C programming language for beginners
ShreyaSingh291866
 
DOCX
C Programming
Sumant Diwakar
 
PDF
Common problems solving using c
ArghodeepPaul
 
PDF
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DR B.Surendiran .
 
PDF
PCA-2 Programming and Solving 2nd Sem.pdf
Ashutoshprasad27
 
DOCX
PCA-2 Programming and Solving 2nd Sem.docx
Ashutoshprasad27
 
PPTX
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
hamzah7958
 
DOCX
Muzzammilrashid
muzzammilrashid
 
DOCX
Basic of c programming www.eakanchha.com
Akanchha Agrawal
 
PPTX
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
PDF
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 

More Related Content

Similar to C Language Programming Introduction Lecture (20)

PPT
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
DOCX
Practical write a c program to reverse a given number
Mainak Sasmal
 
DOCX
Practical write a c program to reverse a given number
Mainak Sasmal
 
DOCX
Programming fundamentals
Zaibi Gondal
 
DOCX
C Programming
Sumant Diwakar
 
PDF
First c program
Komal Pardeshi
 
PPTX
Input and Output In C Language
Adnan Khan
 
DOCX
Best C Programming Solution
yogini sharma
 
DOCX
Write a program that reads in integer as many as the user enters from.docx
lez31palka
 
DOCX
C file
simarsimmygrewal
 
PPT
Functions in c
KavithaMuralidharan2
 
PPTX
C programming language for beginners
ShreyaSingh291866
 
DOCX
C Programming
Sumant Diwakar
 
PDF
Common problems solving using c
ArghodeepPaul
 
PDF
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DR B.Surendiran .
 
PDF
PCA-2 Programming and Solving 2nd Sem.pdf
Ashutoshprasad27
 
DOCX
PCA-2 Programming and Solving 2nd Sem.docx
Ashutoshprasad27
 
PPTX
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
hamzah7958
 
DOCX
Muzzammilrashid
muzzammilrashid
 
DOCX
Basic of c programming www.eakanchha.com
Akanchha Agrawal
 
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
Practical write a c program to reverse a given number
Mainak Sasmal
 
Practical write a c program to reverse a given number
Mainak Sasmal
 
Programming fundamentals
Zaibi Gondal
 
C Programming
Sumant Diwakar
 
First c program
Komal Pardeshi
 
Input and Output In C Language
Adnan Khan
 
Best C Programming Solution
yogini sharma
 
Write a program that reads in integer as many as the user enters from.docx
lez31palka
 
Functions in c
KavithaMuralidharan2
 
C programming language for beginners
ShreyaSingh291866
 
C Programming
Sumant Diwakar
 
Common problems solving using c
ArghodeepPaul
 
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...
DR B.Surendiran .
 
PCA-2 Programming and Solving 2nd Sem.pdf
Ashutoshprasad27
 
PCA-2 Programming and Solving 2nd Sem.docx
Ashutoshprasad27
 
Lecture-2.pptxefygefyeyyegfygcyewvwvvcvywcy
hamzah7958
 
Muzzammilrashid
muzzammilrashid
 
Basic of c programming www.eakanchha.com
Akanchha Agrawal
 

Recently uploaded (20)

PPTX
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
PDF
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 
PDF
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
PDF
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
PDF
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
PDF
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
PPTX
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
PPTX
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
PDF
VCE Literature Section A Exam Response Guide
jpinnuck
 
PPTX
List View Components in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Photo chemistry Power Point Presentation
mprpgcwa2024
 
PPTX
How to use _name_search() method in Odoo 18
Celine George
 
PPTX
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
PPTX
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
PDF
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
PPTX
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
PPTX
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
PDF
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
PPTX
June 2025 Progress Update With Board Call_In process.pptx
International Society of Service Innovation Professionals
 
PPTX
Wage and Salary Computation.ppt.......,x
JosalitoPalacio
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
LDMMIA Yoga S10 Free Workshop Grad Level
LDM & Mia eStudios
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Romanticism in Love and Sacrifice An Analysis of Oscar Wilde’s The Nightingal...
KaryanaTantri21
 
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
VCE Literature Section A Exam Response Guide
jpinnuck
 
List View Components in Odoo 18 - Odoo Slides
Celine George
 
Photo chemistry Power Point Presentation
mprpgcwa2024
 
How to use _name_search() method in Odoo 18
Celine George
 
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
F-BLOCK ELEMENTS POWER POINT PRESENTATIONS
mprpgcwa2024
 
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
ENGLISH-5 Q1 Lesson 1.pptx - Story Elements
Mayvel Nadal
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
June 2025 Progress Update With Board Call_In process.pptx
International Society of Service Innovation Professionals
 
Wage and Salary Computation.ppt.......,x
JosalitoPalacio
 
Ad

C Language Programming Introduction Lecture

  • 2. COMPUTER PROGRAM • A computer program is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.
  • 6. WRITE THE BASIC STRUCTURE OF C PROGRAMMING LANGUAGE. #include <stdio.h> int main() { // Print Name printf("Name : Alexandra Abramovn"); // Print Date of Birth printf("DOB : July 14, 1975n"); // Print Mobile Number printf("Mobile : 99-9999999999n"); // Indicate successful execution return(0); }
  • 7. EXPLANATION • #include <stdio.h>: This line includes the standard input-output library, which contains functions for reading and writing data to and from the console. • int main(): This is the main function of the program, where execution begins. It returns an integer value, typically 0, to indicate successful execution. • Inside the "main()" function, there are three printf statements. The "printf()" function is used to print formatted text to the console. Each printf statement prints a line of text with specific information: • printf ("Name : Alexandra Abramovn"); prints "Name : Alexandra Abramov" followed by a newline character, which moves the cursor to the next line. • printf ("DOB : July 14, 1975n"); prints "DOB : July 14, 1975" followed by a newline character. • printf ("Mobile : 99-9999999999n"); prints "Mobile : 99-9999999999" followed by a newline character. • return(0);: This line indicates the end of the main function and returns 0.
  • 8. THINGS TO KNOW • printf is used for displaying output with formatted strings. • scanf is used for reading input with formatted strings. • %d in scanf tells the program to expect an integer input • i.e. %d is a way of telling the program to handle integer data when displaying output (with printf) or when reading input (with scanf). C is case sensitive. All commands in C must be lowercase.
  • 10. WRITE A C PROGRAM TO INPUT TWO NUMBERS AND SHOW ADDITION & SUBTRACTION. #include <stdio.h> int main() { int n1, n2; printf("Enter First number: "); scanf("%d", &n1); printf("Enter Second number: "); scanf("%d", &n2); printf("Sum of Given Two Numbers =: %d n", n1+n2); printf("Subtraction of Given Two Numbers =: %d n", n1- n2); printf("Product of Given Two Numbers =: %d n", n1*n2); return 0; }
  • 11. WRITE A C PROGRAM TO INPUT TWO NUMBERS AND DIVIDE. #include<stdio.h> int main(){ int num1, num2, quotient; //Asking for input printf("Enter first number: "); scanf("%d", &num1); printf("Enter second number: "); scanf("%d", &num2); //Computing quotient quotient = num1 / num2; printf("Quotient: %d", quotient); return 0; }
  • 12. WRITE A C PROGRAM TO SHOW THE SQUARE OF AN INPUTTED NUMBER. #include <stdio.h> int main() { int number; printf("Enter a number: "); scanf("%d", &number); printf("Square of Number is: %dn", number*number); return 0; }
  • 13. WRITE A C PROGRAM TO ASK A NUMBER INPUT FROM A USER AND DETERMINE WHETHER THE NUM IS EVEN OR ODD. #include <stdio.h> int main() { int n; printf("Enter A number: "); scanf("%d", &n); if (n % 2 == 0) { printf("%d is an even number.n", n); } else { printf("%d is an odd number.n", n); } return 0; }
  • 14. WRITE A C PROGRAM TO SHOW THE TABLE OF AN INPUTTED NUMBER. • #include <stdio.h> • int main() { • int number; • // Input number from user • printf("Enter a number: "); • scanf("%d", &number); • // Display multiplication table • printf("Multiplication table for %d:n", number); • for (int i = 1; i <= 10; ++i) { • printf("%d x %d = %dn", number, i, number * i); • } • return 0; • }
  • 15. H.W • Write a C program to compute the perimeter and area of a rectangle with a length of 7 inches and width of 5 inches. Expected Output: Perimeter of the rectangle = 24 inches Area of the rectangle = 35 square inches • Write a C program to compute the perimeter and area of a circle with user input radius. Expected Output Example: Perimeter of the Circle = 37.680000 inches Area of the Circle = 113.040001 square inches • Write a C program to convert specified days into years, weeks and days. Note: Ignore leap year.