SlideShare una empresa de Scribd logo
1 de 12
Programming in C 1322174
SignaturePage 1
PROGRAM – 1
A programming language defines a set of instructions that are compiled together to Performa specific
tasks by the CPU (central Processing Unit). The programming language mainly refers to high – level
languages such as C, C++, Pascal, Ada, COBOL , etc .
Each Programming languages contains a unique set of keywords and syntax, which are used to create a
set of instructions. Thousands of programming languages have been developed till now, but each
languages has its specific purpose . These languages vary in t the level of abstraction they provide from
the hardware . Some programming languages provide less or no abstracton while some provide higher
abstraction . Based on the levels of abstraction, they can be classified into two categories:
Low – level language
High – level language
LOW-LEVEL LANGUAGES
The low level languages is a programming languages that provides no abstraction from the
hardware, and it is represent in 0 and 1 forms , which are the machine instructions . The
languages that come under this category are the Machine level languages and Assembly
languages.
HIGH – LEVEL LANGUAGES
The high- level language is a programming language that allows a programmer to write the programs
which are independent of a particular type of computer . The high-level languages are considered as
high- level languages because they are closer to human languages than machine – level languages .
When writing a program in a high – level language , then the whole attention needs to be paid to the
logic of the problem .
A compiler is required to translate a high – level language into a low – level language .
PROGRAM STRUCTURE
Programming in C 1322174
SignaturePage 2
Programming in C 1322174
SignaturePage 3
PROGRAM – 2
AIM:-Write a program to print “hello world ”
#include<stdio.h>
#include<conio.h>
Int main()
{
Printf(“Hello world”);
}
getch();
output
PROGRAM -3
AIM:-Write a program to add a two number.
Programming in C 1322174
SignaturePage 4
#include<stdio.h>
#include<conio.h>
Int main()
{
Int a, b, sum;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
Sum=a+b;
Printf(“%d”,sum);
Getch();
}
OUTPUT
PROGRAM-4
AIM:-Write a program to subtract two number
#include<stdio.h>
Programming in C 1322174
SignaturePage 5
#include<conio.h>
Int main()
{
Int a, b, sub;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
Sub=a-b;
Printf(“%d”,sub);
Getch();
}
OUTPUT
PROGRAM-5
AIM:- Write a program multiple to two number
#include<stdio.h>
#include<conio.h>
Programming in C 1322174
SignaturePage 6
Int main()
{
Int a, b, multiply;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
multiply=a*b;
Printf(“%d”,multiply);
Getch();
}
OUTPUT
PROGRAM-6
AIM:-Write a program to Divide a two number
#include<stdio.h>
#include<conio.h>
Int main()
Programming in C 1322174
SignaturePage 7
{
Int a, b, div;
Printf(“a”);
Scanf(“%d”,&a);
Printf(“b”);
Scanf(“%d”,&b);
div=a/b;
Printf(“%d”,div);
Getch();
}
OUTPUT
PROGRAM -7
AIM:-Write a program area of circle
#include<stdio.h>
#include<conio.h>
Int main()
Programming in C 1322174
SignaturePage 8
{
Float r , area;
Printf(“r”);
Scanf(“%f”,&r);
Area=3.14*r*r;
Printf(“%f”,area);
Getch();
}
OUTPUT
PROGRAM-8
AIM:-Write a program of area of square
#include<stdio.h>
#include<conio.h>
Int main()
{
Programming in C 1322174
SignaturePage 9
Int a , area;
Printf(“a”);
Scanf(“%d”,&a);
Area=a*a
Printf(“%d”,area);
Getch();
}
OUTPUT
PROGRAM-9
AIM:-Program to Print an Integer
#include<stdio.h>
Int main()
{
Printf(“Enter an integer”);
// reads and stores input
Programming in C 1322174
SignaturePage 10
Scanf(“%d”,&number);
//displays output
Printf(“you entered:%d”,number);
Return0:
}
OUTPUT
PROGRAM-10
AIM:-Program to compute Quotient and Remainder
#include<stdio.h>
Int main(){
Int dividend, divisor , quotient , remainder;
Printf(“Enter dividend:”);
Scanf(“%d”, &dividend);
Printf(“Enter divisor:”);
Programming in C 1322174
SignaturePage 11
Scanf(“%d”, &divisor);
// computes quotient
Quotient = dividend / divisor;
//computes remainder
remainder= dividend % divisor;
printf(“Quotients = %dn”, quotient);
printf(“Remainder = %d”, remainder);
return0;
}
OUTPUT
Program – 11
AIM:-Program to Find the size of variable.
#include<stdio.h>
int main(){
int intType;
float floatType;
double doubleType;
Programming in C 1322174
SignaturePage 12
char charType;
//sizeof evaluates the size of a variable
printf("Size of int: %zu bytes/n", sizeof(intType));
printf("Size of float: %zu bytes/n", sizeof(floatType));
printf("Size of double: %zu bytes/n", sizeof(doubleType));
printf("Size of char: %zu bytes/n", sizeof(charType));
return 0;
}
OUTPUT

Más contenido relacionado

Similar a C PROGRAMS 1.docx

C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDY
Rajeshkumar Reddy
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
Tech
 

Similar a C PROGRAMS 1.docx (20)

Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
C-PROGRAMMING-LANGUAGE.pptx
C-PROGRAMMING-LANGUAGE.pptxC-PROGRAMMING-LANGUAGE.pptx
C-PROGRAMMING-LANGUAGE.pptx
 
Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)Std 10 computer chapter 10 introduction to c language (part1)
Std 10 computer chapter 10 introduction to c language (part1)
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
 
C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDY
 
Programming assignment help
Programming assignment helpProgramming assignment help
Programming assignment help
 
High Level Language (HLL)
High Level Language (HLL)High Level Language (HLL)
High Level Language (HLL)
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
 
Intoduction to c language
Intoduction to c languageIntoduction to c language
Intoduction to c language
 
Starting c++
Starting c++Starting c++
Starting c++
 
maincse-150510153437-lva1-app6892 (1).pptx
maincse-150510153437-lva1-app6892 (1).pptxmaincse-150510153437-lva1-app6892 (1).pptx
maincse-150510153437-lva1-app6892 (1).pptx
 
all languages in computer programming
all languages in computer programmingall languages in computer programming
all languages in computer programming
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
IITK ESC 111M Lec02.pptx .
IITK ESC 111M Lec02.pptx               .IITK ESC 111M Lec02.pptx               .
IITK ESC 111M Lec02.pptx .
 
Fundamentals of programming with C++
Fundamentals of programming with C++Fundamentals of programming with C++
Fundamentals of programming with C++
 
Chapter 1 Introduction to C .pptx
Chapter 1 Introduction to C .pptxChapter 1 Introduction to C .pptx
Chapter 1 Introduction to C .pptx
 
Introduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem AnsariIntroduction to Programming Concepts By Aamir Saleem Ansari
Introduction to Programming Concepts By Aamir Saleem Ansari
 
class1.pdf
class1.pdfclass1.pdf
class1.pdf
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

C PROGRAMS 1.docx

  • 1. Programming in C 1322174 SignaturePage 1 PROGRAM – 1 A programming language defines a set of instructions that are compiled together to Performa specific tasks by the CPU (central Processing Unit). The programming language mainly refers to high – level languages such as C, C++, Pascal, Ada, COBOL , etc . Each Programming languages contains a unique set of keywords and syntax, which are used to create a set of instructions. Thousands of programming languages have been developed till now, but each languages has its specific purpose . These languages vary in t the level of abstraction they provide from the hardware . Some programming languages provide less or no abstracton while some provide higher abstraction . Based on the levels of abstraction, they can be classified into two categories: Low – level language High – level language LOW-LEVEL LANGUAGES The low level languages is a programming languages that provides no abstraction from the hardware, and it is represent in 0 and 1 forms , which are the machine instructions . The languages that come under this category are the Machine level languages and Assembly languages. HIGH – LEVEL LANGUAGES The high- level language is a programming language that allows a programmer to write the programs which are independent of a particular type of computer . The high-level languages are considered as high- level languages because they are closer to human languages than machine – level languages . When writing a program in a high – level language , then the whole attention needs to be paid to the logic of the problem . A compiler is required to translate a high – level language into a low – level language . PROGRAM STRUCTURE
  • 2. Programming in C 1322174 SignaturePage 2
  • 3. Programming in C 1322174 SignaturePage 3 PROGRAM – 2 AIM:-Write a program to print “hello world ” #include<stdio.h> #include<conio.h> Int main() { Printf(“Hello world”); } getch(); output PROGRAM -3 AIM:-Write a program to add a two number.
  • 4. Programming in C 1322174 SignaturePage 4 #include<stdio.h> #include<conio.h> Int main() { Int a, b, sum; Printf(“a”); Scanf(“%d”,&a); Printf(“b”); Scanf(“%d”,&b); Sum=a+b; Printf(“%d”,sum); Getch(); } OUTPUT PROGRAM-4 AIM:-Write a program to subtract two number #include<stdio.h>
  • 5. Programming in C 1322174 SignaturePage 5 #include<conio.h> Int main() { Int a, b, sub; Printf(“a”); Scanf(“%d”,&a); Printf(“b”); Scanf(“%d”,&b); Sub=a-b; Printf(“%d”,sub); Getch(); } OUTPUT PROGRAM-5 AIM:- Write a program multiple to two number #include<stdio.h> #include<conio.h>
  • 6. Programming in C 1322174 SignaturePage 6 Int main() { Int a, b, multiply; Printf(“a”); Scanf(“%d”,&a); Printf(“b”); Scanf(“%d”,&b); multiply=a*b; Printf(“%d”,multiply); Getch(); } OUTPUT PROGRAM-6 AIM:-Write a program to Divide a two number #include<stdio.h> #include<conio.h> Int main()
  • 7. Programming in C 1322174 SignaturePage 7 { Int a, b, div; Printf(“a”); Scanf(“%d”,&a); Printf(“b”); Scanf(“%d”,&b); div=a/b; Printf(“%d”,div); Getch(); } OUTPUT PROGRAM -7 AIM:-Write a program area of circle #include<stdio.h> #include<conio.h> Int main()
  • 8. Programming in C 1322174 SignaturePage 8 { Float r , area; Printf(“r”); Scanf(“%f”,&r); Area=3.14*r*r; Printf(“%f”,area); Getch(); } OUTPUT PROGRAM-8 AIM:-Write a program of area of square #include<stdio.h> #include<conio.h> Int main() {
  • 9. Programming in C 1322174 SignaturePage 9 Int a , area; Printf(“a”); Scanf(“%d”,&a); Area=a*a Printf(“%d”,area); Getch(); } OUTPUT PROGRAM-9 AIM:-Program to Print an Integer #include<stdio.h> Int main() { Printf(“Enter an integer”); // reads and stores input
  • 10. Programming in C 1322174 SignaturePage 10 Scanf(“%d”,&number); //displays output Printf(“you entered:%d”,number); Return0: } OUTPUT PROGRAM-10 AIM:-Program to compute Quotient and Remainder #include<stdio.h> Int main(){ Int dividend, divisor , quotient , remainder; Printf(“Enter dividend:”); Scanf(“%d”, &dividend); Printf(“Enter divisor:”);
  • 11. Programming in C 1322174 SignaturePage 11 Scanf(“%d”, &divisor); // computes quotient Quotient = dividend / divisor; //computes remainder remainder= dividend % divisor; printf(“Quotients = %dn”, quotient); printf(“Remainder = %d”, remainder); return0; } OUTPUT Program – 11 AIM:-Program to Find the size of variable. #include<stdio.h> int main(){ int intType; float floatType; double doubleType;
  • 12. Programming in C 1322174 SignaturePage 12 char charType; //sizeof evaluates the size of a variable printf("Size of int: %zu bytes/n", sizeof(intType)); printf("Size of float: %zu bytes/n", sizeof(floatType)); printf("Size of double: %zu bytes/n", sizeof(doubleType)); printf("Size of char: %zu bytes/n", sizeof(charType)); return 0; } OUTPUT