Mahesh Sharma (Acharya) BSc. (Hons) in Computing Email: mahesh.kathmandu@outlook.com Phone: 9803151129, Address: Chandol-4, KTM
Expectations…. • Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 2 3/3/2021
Agendas • Computer programming • Importance of computer programming • C programming with history • Features of C programming • Features of a good program • Syntax and Semantics Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 3 3/3/2021
• Software is a set of instructions that provides information to computer to solve problems. Smallest form of software is a program. • Computers understand instructions that are written in a specific syntax called a programming language • Features fast, cheap and work 24x7, accurate data, storage capacity and reliability • Programming language are used to write instructions to computer system Examples of programming languages: C, C++, Java, PHP, QBASIC, Python etc. There are around 600 programming languages out there in world Note: Programmers write a program by using programming language. Computer Programming 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 4
Why to learn Computer programming? • Programming is fun to work: with modern devices, application egg. Gaming, video making, photography, infographics, making with application of computer • Pretty good salary : Google, Facebook, Microsoft, Apple, Amazon, and many others pay good salary to employees and national economy • Computers programs are used in every field : School, college, banks, finance, hospital, health post, government, military, travel and tourism etc. • Modern tool to increase productivity and performance: provides assistance to increase productivity and performance of employee and organization 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 5
C programming • It is an amazing and simple language that helps you develop complex software applications with ease. • Invented by Dennis Ritchie (Father of C programming) at Bell Laboratories in early 1970s • Standard in coding of C programming was done in 1989 by American National Standard Institute as ANSI C • C is a high-level programming language that supports low-level programming language • The development of C language was followed by the origin of Unix, the first operating system implemented in a high-level language 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 6
Features of C programming • Portable usability of the same fragment of code in different environments (object oriented programming) • Library functions pre-defined in C makes it an optimal choice for programming • Almost all programming languages are derived from C inherited their features from C mother of all programming languages. • If you learn C, it becomes easy for you to learn programming languages like Ruby, Python, PHP, C++, JAVA and more • C is a compiler based language, that is, to execute a code we first need to compile it. • C is case sensitive if you write “program” and “Program”, both of them would connote different meanings in C. 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 7
Weakness of C programming • Difficulties to make changes in program that we write to solve the problems: modification and update issues • Difficulties to debug the errors during programming in C: correction of errors or bugs are complex • Difficulties to write complex code for solution: takes longer times and planning to write programs for bigger project 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 8
Program Characteristics • Some of the common characteristics of a good program are readability and portability • Readability: Should be clear in reading and correction or updates for future reference • Easy to understand: Should be with simple logics with comments for reference • Maintain integrity: accurate in calculation and information • Modular approach: should be easily be broken into pieces or module such that for reusability e.g. Model View Controller (MVC) architecture 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 9
Syntax and Semantics • syntax is about the form of language(example grammar of English) • If syntax is wrong, program will not run or it will show instant error message • semantics about meaning like formulas, instruction, comment etc. • If semantics is wrong, program will be wrong but with incorrect output 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 10
Basic Structure of C programming 1. Documents Section: Title of project, Name of author, start date, and other comments 2. Link section: Provides instruction to compiler about system library <stdio.h> <conio.h> 3. Definition Section: Defines constant and variables used within a function of a program 4. Global Declaration Section: different variables that are used in different functions of program are defined here 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 11
Basic Structure Cont.… 5. Main function Section: Includes declaration part and execution part Declaration part includes all variables that are used in execution part Execution part includes all arithmetic and logical statements Main function statements must end with ; and enclosed by curly braces; and it must contain at least one statement. 6. Sub Program Section: User defined functions created in this section. Includes sub parts of main program 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 12
C programming example /*My first program in C—Mahesh Sharma—2077/11/18 – includes all programming structure*/ #include <stdio.h> #include <conio.h> main ( ) { clrscr(); printf(“Hello World n”); getch(); } 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 13 Write a program to display you name in any text editor, compile and then run it and save the program
Any Questions? Thank you. Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 14 3/3/2021

Presentation on C programming language

  • 1.
    Mahesh Sharma (Acharya) BSc.(Hons) in Computing Email: mahesh.kathmandu@outlook.com Phone: 9803151129, Address: Chandol-4, KTM
  • 2.
    Expectations…. • Presented by: MaheshSharma, B.Sc.. (Hons) Computing 2 3/3/2021
  • 3.
    Agendas • Computer programming •Importance of computer programming • C programming with history • Features of C programming • Features of a good program • Syntax and Semantics Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 3 3/3/2021
  • 4.
    • Software isa set of instructions that provides information to computer to solve problems. Smallest form of software is a program. • Computers understand instructions that are written in a specific syntax called a programming language • Features fast, cheap and work 24x7, accurate data, storage capacity and reliability • Programming language are used to write instructions to computer system Examples of programming languages: C, C++, Java, PHP, QBASIC, Python etc. There are around 600 programming languages out there in world Note: Programmers write a program by using programming language. Computer Programming 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 4
  • 5.
    Why to learnComputer programming? • Programming is fun to work: with modern devices, application egg. Gaming, video making, photography, infographics, making with application of computer • Pretty good salary : Google, Facebook, Microsoft, Apple, Amazon, and many others pay good salary to employees and national economy • Computers programs are used in every field : School, college, banks, finance, hospital, health post, government, military, travel and tourism etc. • Modern tool to increase productivity and performance: provides assistance to increase productivity and performance of employee and organization 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 5
  • 6.
    C programming • Itis an amazing and simple language that helps you develop complex software applications with ease. • Invented by Dennis Ritchie (Father of C programming) at Bell Laboratories in early 1970s • Standard in coding of C programming was done in 1989 by American National Standard Institute as ANSI C • C is a high-level programming language that supports low-level programming language • The development of C language was followed by the origin of Unix, the first operating system implemented in a high-level language 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 6
  • 7.
    Features of Cprogramming • Portable usability of the same fragment of code in different environments (object oriented programming) • Library functions pre-defined in C makes it an optimal choice for programming • Almost all programming languages are derived from C inherited their features from C mother of all programming languages. • If you learn C, it becomes easy for you to learn programming languages like Ruby, Python, PHP, C++, JAVA and more • C is a compiler based language, that is, to execute a code we first need to compile it. • C is case sensitive if you write “program” and “Program”, both of them would connote different meanings in C. 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 7
  • 8.
    Weakness of Cprogramming • Difficulties to make changes in program that we write to solve the problems: modification and update issues • Difficulties to debug the errors during programming in C: correction of errors or bugs are complex • Difficulties to write complex code for solution: takes longer times and planning to write programs for bigger project 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 8
  • 9.
    Program Characteristics • Someof the common characteristics of a good program are readability and portability • Readability: Should be clear in reading and correction or updates for future reference • Easy to understand: Should be with simple logics with comments for reference • Maintain integrity: accurate in calculation and information • Modular approach: should be easily be broken into pieces or module such that for reusability e.g. Model View Controller (MVC) architecture 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 9
  • 10.
    Syntax and Semantics •syntax is about the form of language(example grammar of English) • If syntax is wrong, program will not run or it will show instant error message • semantics about meaning like formulas, instruction, comment etc. • If semantics is wrong, program will be wrong but with incorrect output 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 10
  • 11.
    Basic Structure ofC programming 1. Documents Section: Title of project, Name of author, start date, and other comments 2. Link section: Provides instruction to compiler about system library <stdio.h> <conio.h> 3. Definition Section: Defines constant and variables used within a function of a program 4. Global Declaration Section: different variables that are used in different functions of program are defined here 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 11
  • 12.
    Basic Structure Cont.… 5.Main function Section: Includes declaration part and execution part Declaration part includes all variables that are used in execution part Execution part includes all arithmetic and logical statements Main function statements must end with ; and enclosed by curly braces; and it must contain at least one statement. 6. Sub Program Section: User defined functions created in this section. Includes sub parts of main program 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 12
  • 13.
    C programming example /*Myfirst program in C—Mahesh Sharma—2077/11/18 – includes all programming structure*/ #include <stdio.h> #include <conio.h> main ( ) { clrscr(); printf(“Hello World n”); getch(); } 3/3/2021 Presented by: Mahesh Sharma, B.Sc.. (Hons) Computing 13 Write a program to display you name in any text editor, compile and then run it and save the program
  • 14.
    Any Questions? Thank you. Presentedby: Mahesh Sharma, B.Sc.. (Hons) Computing 14 3/3/2021