This document discusses various topics related to C programming including variables, data types, operators, functions, and program structure. It begins with an introduction to variables and data types in C like integer, float, char etc. It then covers various operators used in C for arithmetic, relational, logical, and bitwise operations. The document also discusses constants, global and local variables. It explains function structure in C including function declaration, definition, and calls. Finally, it provides an overview of the C program compilation process.
Programming for Problem Solving Unit 1Dhiviya Rose
The document discusses a course on programming for problem solving that covers the history and evolution of computers from the abacus to modern machines, different types and generations of computers, number systems including binary, octal, decimal, and hexadecimal, and how to convert between number systems. It also provides an outline of topics to be covered in the course like computer organization, C programming basics, arrays and strings, functions and pointers, structures and unions.
C formatted and unformatted input and output constructsGopikaS12
This document discusses various C input and output functions such as getchar(), putchar(), gets(), puts(), scanf(), printf(), getch(), and getche(). It explains that getchar() reads a single character from standard input while putchar() displays a character. Gets() reads a line into a buffer until a newline, and puts() writes the string and newline to output. Scanf() stops reading after spaces but gets() reads spaces. Printf() uses format specifiers in a control string to display variables in the desired format.
C Tokens, Escape sequence, Delimiters, Variables, Data types, Constants/ Literals, Expressions, Statements and Comments
https://github.com/ashim888/csit-c
The document discusses intermediate code generation in compilers. It describes how compilers generate intermediate code representations after parsing source code. Intermediate representations allow separating the front-end and back-end of compilers, facilitating code optimization and retargeting compilers to different architectures. Common intermediate representations discussed include abstract syntax trees, postfix notation, static single assignment form, and three-address instructions. The document also provides examples of generating three-address code using syntax-directed translation.
This document summarizes an lecture on applications of strings and pointers in C programming. It includes examples of using arrays of strings, pointer arithmetic, double pointers, scanf vs gets functions, generating Fibonacci series using recursion, and using the ceil() and floor() math functions. The lecture covers basic and advanced concepts of strings and pointers through examples and explanations.
This document discusses input and output operations in C programming. It explains that input/output functions provide the link between the user and terminal. Standard input functions like scanf() are used to read data from keyboard while standard output functions like printf() display results on screen. Formatted functions like scanf() and printf() allow input/output to be formatted according to requirements. Unformatted functions like getchar() and putchar() deal with single characters. The standard library stdio.h provides predefined functions for input and output in C.
At the end of this lecture students should be able to;
Define the C standard functions for managing input output.
Apply taught concepts for writing programs.
C programming_MSBTE_Diploma_Pranoti DokePranoti Doke
"1.1 Structure of ‘C’program, Assembler, Linker, Compiler, Interpreter.
1.2 ‘C’character set-keywords, identifiers, types of constants (Integer, single character, string, and real) variables, scope of variables, concept of ASCII.
1.3 Data types: integer- unsigned, signed, long, float- float, double, character char, string, octal, hexadecimal
1.4 Algorithm and flow chart.
1.5 Formatted input and output statements. Input and output function.
1.6 Operators and expressions:
a. Operators in ‘C’- arithmetic, logical, assignment, relational, increment and decrement, conditional, bit wise, special operators
b. Expressions
c. Precedence and associatively."
"2.1 Decision making if statement (if, if-else, nested if-else), switch –case statement.
2.2 Repetition in ‘C’ (loop control
statement) while, do-while and for loop, break and continue statement, nested loops
"
"3.1 Introduction to Array and its types
3.2 Declaration, initialization of array,
accessing elements of an array, adding,
deleting, sorting & searching.
3.3 Introduction to string Initializing,
declaring and display of string
3.4 String handling functions from standard library (strlen (), strcpy (), strcat (), strcmp(), strlwr(),strupr()):
"
"4.1 Concept and need of functions
4.2 Library functions: Math functions,
String handling functions, other
miscellaneous functions.
4.3 Writing User defined functions, scope of variables.
4.4 Parameter passing: call by value, call by reference.
4.5 Recursive functions
"
"5.1 Concept of pointer and pointer variables, initialization of pointer, call-by reference.
5.2 Pointer arithmetic.
5.3 Handling arrays using pointers
5.4 Handling functions using pointers
"
"6.1 Introduction and Features and Syntax of structure
6.2 Declaration and Initialization of
Structures
6.3 Initializing, assessing structure members using pointers
6.4 Type def, Enumerated Data Type,
using structures in C Program
6.5 Operations on structure."
Programming for Problem Solving Unit 1Dhiviya Rose
The document discusses a course on programming for problem solving that covers the history and evolution of computers from the abacus to modern machines, different types and generations of computers, number systems including binary, octal, decimal, and hexadecimal, and how to convert between number systems. It also provides an outline of topics to be covered in the course like computer organization, C programming basics, arrays and strings, functions and pointers, structures and unions.
C formatted and unformatted input and output constructsGopikaS12
This document discusses various C input and output functions such as getchar(), putchar(), gets(), puts(), scanf(), printf(), getch(), and getche(). It explains that getchar() reads a single character from standard input while putchar() displays a character. Gets() reads a line into a buffer until a newline, and puts() writes the string and newline to output. Scanf() stops reading after spaces but gets() reads spaces. Printf() uses format specifiers in a control string to display variables in the desired format.
C Tokens, Escape sequence, Delimiters, Variables, Data types, Constants/ Literals, Expressions, Statements and Comments
https://github.com/ashim888/csit-c
The document discusses intermediate code generation in compilers. It describes how compilers generate intermediate code representations after parsing source code. Intermediate representations allow separating the front-end and back-end of compilers, facilitating code optimization and retargeting compilers to different architectures. Common intermediate representations discussed include abstract syntax trees, postfix notation, static single assignment form, and three-address instructions. The document also provides examples of generating three-address code using syntax-directed translation.
This document summarizes an lecture on applications of strings and pointers in C programming. It includes examples of using arrays of strings, pointer arithmetic, double pointers, scanf vs gets functions, generating Fibonacci series using recursion, and using the ceil() and floor() math functions. The lecture covers basic and advanced concepts of strings and pointers through examples and explanations.
This document discusses input and output operations in C programming. It explains that input/output functions provide the link between the user and terminal. Standard input functions like scanf() are used to read data from keyboard while standard output functions like printf() display results on screen. Formatted functions like scanf() and printf() allow input/output to be formatted according to requirements. Unformatted functions like getchar() and putchar() deal with single characters. The standard library stdio.h provides predefined functions for input and output in C.
At the end of this lecture students should be able to;
Define the C standard functions for managing input output.
Apply taught concepts for writing programs.
C programming_MSBTE_Diploma_Pranoti DokePranoti Doke
"1.1 Structure of ‘C’program, Assembler, Linker, Compiler, Interpreter.
1.2 ‘C’character set-keywords, identifiers, types of constants (Integer, single character, string, and real) variables, scope of variables, concept of ASCII.
1.3 Data types: integer- unsigned, signed, long, float- float, double, character char, string, octal, hexadecimal
1.4 Algorithm and flow chart.
1.5 Formatted input and output statements. Input and output function.
1.6 Operators and expressions:
a. Operators in ‘C’- arithmetic, logical, assignment, relational, increment and decrement, conditional, bit wise, special operators
b. Expressions
c. Precedence and associatively."
"2.1 Decision making if statement (if, if-else, nested if-else), switch –case statement.
2.2 Repetition in ‘C’ (loop control
statement) while, do-while and for loop, break and continue statement, nested loops
"
"3.1 Introduction to Array and its types
3.2 Declaration, initialization of array,
accessing elements of an array, adding,
deleting, sorting & searching.
3.3 Introduction to string Initializing,
declaring and display of string
3.4 String handling functions from standard library (strlen (), strcpy (), strcat (), strcmp(), strlwr(),strupr()):
"
"4.1 Concept and need of functions
4.2 Library functions: Math functions,
String handling functions, other
miscellaneous functions.
4.3 Writing User defined functions, scope of variables.
4.4 Parameter passing: call by value, call by reference.
4.5 Recursive functions
"
"5.1 Concept of pointer and pointer variables, initialization of pointer, call-by reference.
5.2 Pointer arithmetic.
5.3 Handling arrays using pointers
5.4 Handling functions using pointers
"
"6.1 Introduction and Features and Syntax of structure
6.2 Declaration and Initialization of
Structures
6.3 Initializing, assessing structure members using pointers
6.4 Type def, Enumerated Data Type,
using structures in C Program
6.5 Operations on structure."
The document discusses input and output functions in C programming. It describes formatted functions like printf() and scanf() that allow input and output with formatting. It also describes unformatted functions like getchar(), putchar(), gets(), and puts() that handle character and string input/output without formatting. The formatted functions require format specifiers while the unformatted functions work only with character data types.
This chapter discusses fundamental concepts of C programming language and basic input/output functions. It covers C development environment, C program structure including main functions and statements, basic data types, input/output functions like printf and scanf, and common programming errors.
Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.
C language has a series of standard input-output (I/O) functions. Such I/O functions together form a library named stdio.h. Irrespective of the version of C language, user will have access to all such library functions. These library functions are classified into three broad categories.
a) Console I/O functions : Functions which accept input from keyboard and produce output on the screen.
b) Disk I/O functions : Functions which perform I/O operations on secondary storage devices like floppy disks or hard disks.
c) Port I/O functions : Functions which perform I/O operations on various ports like printer port, mouse port, etc.
Console I/
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
The document describes a simple "Hello World" C program that prints three strings to the screen. It contains the main() function which uses printf statements to output the text. Comments provide explanations of key elements like header files, escape characters, and functions.
C++ is an object-oriented programming language that is an extension of C. It was developed in the 1980s to support object-oriented programming. In C++, data and functions can be combined into objects. Data in an object can only be accessed by the object's functions, allowing for encapsulation. The document then provides an overview of key C++ concepts like data types, tokens, operators, and input/output streams to introduce basic C++ syntax and programming.
This document provides an overview of pointers in C programming. It discusses seven rules for pointers, including that pointers are integer variables that store memory addresses, how to dereference and reference pointers, NULL pointers, and arithmetic operations on pointers. It also covers dynamic memory allocation using malloc, calloc, realloc, and free and different approaches to 2D arrays. Finally, it discusses function pointers and their uses, including as callback functions.
C programming & data structure [arrays & pointers]MomenMostafa
This document provides an overview of arrays and pointers in C programming. It defines arrays as a series of elements of the same data type. Arrays can be initialized, accessed using subscripts, and their size determined. Multidimensional arrays contain arrays as elements. Pointers offer an efficient way to work with arrays, as array notation is equivalent to pointer notation. Functions can operate on arrays by passing a pointer to the first element as a parameter.
C is a structured programming language developed by Dennis Ritchie. It supports functions and modularity through header files and libraries. C programs are compiled into executable files. Key features include variables, data types, operators, conditional statements, loops, arrays, structures, pointers, and functions. Functions can be called by value where changes are local, or by reference where changes affect the original variable.
This document provides an introduction to the C++ programming language. It discusses that C++ was developed in 1979 as an extension of C and is an object-oriented language. It then defines various C++ concepts such as tokens, data types, variables, constants, functions, arrays, structures, and input/output streams. It provides examples of how to declare and use these different programming elements in C++ code. The document serves as a high-level overview of fundamental C++ concepts for someone new to the language.
C was created in the early 1970s at Bell Labs by Dennis Ritchie. It is commonly used for systems programming like operating systems and compilers. C code is compiled into efficient, portable machine code. A C program structure includes preprocessor commands, functions, variables, statements/expressions, and comments. Key C language elements are keywords, identifiers, constants, comments, and symbols. C supports various data types like int, char, float, and double that determine memory usage and value representation. Variables must be declared with a specific data type before use.
C programming is a widely used programming language. The document provides an overview of key concepts in C programming including variables, data types, operators, decision and loop control statements, functions, pointers, arrays, strings, structures, and input/output functions. It also provides examples to illustrate concepts like arrays, strings, functions, pointers, and structures. The main function is the entry point for all C programs where code execution begins.
This document defines and explains the basic tokens in C++ programming, including keywords, variables, constants, escape sequences, and operators. Keywords are predefined reserved words with special meanings. Variables are used to store and manipulate data. Constants cannot change value during program execution. Escape sequences represent special characters. Operators specify operations on operands and include arithmetic, relational, logical, and assignment operators.
This document discusses input and output functions in C programming and integers. It provides examples of using format specifiers like %d to print integers. It shows how to declare, assign, and perform math operations on integers. It also demonstrates getting input from the user using scanf and printing output with printf. The document ends by prompting the reader to write a program to calculate simple interest by getting principal, rate, and time inputs from the user.
C++ Programming Language Training in Ambala ! Batra Computer Centrejatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C++ Programming Language Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
The document discusses various input and output functions in C programming. It describes scanf() and printf() for input and output without spaces, gets() and puts() for multi-word input and output, getchar() and putchar() for single character input and output, and getch() and putch() for single character input and output without pressing enter. It also covers format specifiers used with these functions and escape sequences.
C++ is an object-oriented programming language that is based on C and adds object-oriented programming features like classes, inheritance, and polymorphism. It was created by Bjarne Stroustrup at Bell Labs in the early 1980s. The document provides an introduction to C++ including its history, differences from C, program structure, data types, variables, input/output, and integrated development environments.
The document provides an overview of the C++ programming language, including:
- A brief history of C++ and how it was developed based on C while incorporating object-oriented programming features.
- Descriptions of key computer science concepts like hardware, memory, data types, compilers, and the software development process.
- Explanations of core C++ programming concepts like variables, data types, operators, expressions, and identifiers. It also discusses object-oriented features and the standard libraries.
- Short sections on C++ keywords, tokens, structures, advantages and disadvantages.
So in summary, the document introduces the C++ language by covering its origins and evolution, underlying computer science principles, and
This document provides an overview of the C programming language. It discusses that C was created by Dennis Ritchie to directly interact with hardware and is the base for many other languages. It then lists advantages of learning C like it being easy to learn, producing efficient programs, and being compiled on many platforms. The document proceeds to describe different C language elements like tokens, keywords, constants, variables, operators, loops, structures, and unions. It provides examples for many of these elements.
The document discusses input and output functions in C programming. It describes formatted functions like printf() and scanf() that allow input and output with formatting. It also describes unformatted functions like getchar(), putchar(), gets(), and puts() that handle character and string input/output without formatting. The formatted functions require format specifiers while the unformatted functions work only with character data types.
This chapter discusses fundamental concepts of C programming language and basic input/output functions. It covers C development environment, C program structure including main functions and statements, basic data types, input/output functions like printf and scanf, and common programming errors.
Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.
C language has a series of standard input-output (I/O) functions. Such I/O functions together form a library named stdio.h. Irrespective of the version of C language, user will have access to all such library functions. These library functions are classified into three broad categories.
a) Console I/O functions : Functions which accept input from keyboard and produce output on the screen.
b) Disk I/O functions : Functions which perform I/O operations on secondary storage devices like floppy disks or hard disks.
c) Port I/O functions : Functions which perform I/O operations on various ports like printer port, mouse port, etc.
Console I/
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
The document describes a simple "Hello World" C program that prints three strings to the screen. It contains the main() function which uses printf statements to output the text. Comments provide explanations of key elements like header files, escape characters, and functions.
C++ is an object-oriented programming language that is an extension of C. It was developed in the 1980s to support object-oriented programming. In C++, data and functions can be combined into objects. Data in an object can only be accessed by the object's functions, allowing for encapsulation. The document then provides an overview of key C++ concepts like data types, tokens, operators, and input/output streams to introduce basic C++ syntax and programming.
This document provides an overview of pointers in C programming. It discusses seven rules for pointers, including that pointers are integer variables that store memory addresses, how to dereference and reference pointers, NULL pointers, and arithmetic operations on pointers. It also covers dynamic memory allocation using malloc, calloc, realloc, and free and different approaches to 2D arrays. Finally, it discusses function pointers and their uses, including as callback functions.
C programming & data structure [arrays & pointers]MomenMostafa
This document provides an overview of arrays and pointers in C programming. It defines arrays as a series of elements of the same data type. Arrays can be initialized, accessed using subscripts, and their size determined. Multidimensional arrays contain arrays as elements. Pointers offer an efficient way to work with arrays, as array notation is equivalent to pointer notation. Functions can operate on arrays by passing a pointer to the first element as a parameter.
C is a structured programming language developed by Dennis Ritchie. It supports functions and modularity through header files and libraries. C programs are compiled into executable files. Key features include variables, data types, operators, conditional statements, loops, arrays, structures, pointers, and functions. Functions can be called by value where changes are local, or by reference where changes affect the original variable.
This document provides an introduction to the C++ programming language. It discusses that C++ was developed in 1979 as an extension of C and is an object-oriented language. It then defines various C++ concepts such as tokens, data types, variables, constants, functions, arrays, structures, and input/output streams. It provides examples of how to declare and use these different programming elements in C++ code. The document serves as a high-level overview of fundamental C++ concepts for someone new to the language.
C was created in the early 1970s at Bell Labs by Dennis Ritchie. It is commonly used for systems programming like operating systems and compilers. C code is compiled into efficient, portable machine code. A C program structure includes preprocessor commands, functions, variables, statements/expressions, and comments. Key C language elements are keywords, identifiers, constants, comments, and symbols. C supports various data types like int, char, float, and double that determine memory usage and value representation. Variables must be declared with a specific data type before use.
C programming is a widely used programming language. The document provides an overview of key concepts in C programming including variables, data types, operators, decision and loop control statements, functions, pointers, arrays, strings, structures, and input/output functions. It also provides examples to illustrate concepts like arrays, strings, functions, pointers, and structures. The main function is the entry point for all C programs where code execution begins.
This document defines and explains the basic tokens in C++ programming, including keywords, variables, constants, escape sequences, and operators. Keywords are predefined reserved words with special meanings. Variables are used to store and manipulate data. Constants cannot change value during program execution. Escape sequences represent special characters. Operators specify operations on operands and include arithmetic, relational, logical, and assignment operators.
This document discusses input and output functions in C programming and integers. It provides examples of using format specifiers like %d to print integers. It shows how to declare, assign, and perform math operations on integers. It also demonstrates getting input from the user using scanf and printing output with printf. The document ends by prompting the reader to write a program to calculate simple interest by getting principal, rate, and time inputs from the user.
C++ Programming Language Training in Ambala ! Batra Computer Centrejatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C++ Programming Language Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
The document discusses various input and output functions in C programming. It describes scanf() and printf() for input and output without spaces, gets() and puts() for multi-word input and output, getchar() and putchar() for single character input and output, and getch() and putch() for single character input and output without pressing enter. It also covers format specifiers used with these functions and escape sequences.
C++ is an object-oriented programming language that is based on C and adds object-oriented programming features like classes, inheritance, and polymorphism. It was created by Bjarne Stroustrup at Bell Labs in the early 1980s. The document provides an introduction to C++ including its history, differences from C, program structure, data types, variables, input/output, and integrated development environments.
The document provides an overview of the C++ programming language, including:
- A brief history of C++ and how it was developed based on C while incorporating object-oriented programming features.
- Descriptions of key computer science concepts like hardware, memory, data types, compilers, and the software development process.
- Explanations of core C++ programming concepts like variables, data types, operators, expressions, and identifiers. It also discusses object-oriented features and the standard libraries.
- Short sections on C++ keywords, tokens, structures, advantages and disadvantages.
So in summary, the document introduces the C++ language by covering its origins and evolution, underlying computer science principles, and
This document provides an overview of the C programming language. It discusses that C was created by Dennis Ritchie to directly interact with hardware and is the base for many other languages. It then lists advantages of learning C like it being easy to learn, producing efficient programs, and being compiled on many platforms. The document proceeds to describe different C language elements like tokens, keywords, constants, variables, operators, loops, structures, and unions. It provides examples for many of these elements.
This document provides an overview of basic C programming concepts including keywords, identifiers, character sets, data types, variables, operators, and control flow statements. Specifically, it discusses:
- Keywords and identifiers in C and rules for naming them.
- The character set used in C including alphabets, digits, and special characters.
- Basic and derived data types such as int, char, float, arrays, pointers, structures, unions, enums, and void.
- Types of variables like local, global, static, automatic, and external.
- Operators in C including unary, binary, ternary, arithmetic, relational, logical, and bitwise operators.
- Control flow statements
This document provides an overview of an introductory C# programming course. The course covers C# fundamentals like setting up a development environment, data types, conditionals, loops, object-oriented programming concepts, and data structures. It includes topics like installing Visual Studio, writing a "Hello World" program, built-in data types like string, integer, boolean, and more. The document also outlines sample code solutions for exercises on command line arguments, integer operations, leap year finder, and powers of two.
This document provides an outline for a course on C programming for engineers. The course covers topics such as introduction to programming, data types, control statements, functions, pointers, structures, and memory management. It discusses what a computer program is, programming languages like machine language and C, and the software development life cycle. C was created by Dennis Ritchie in the early 1970s and is a general-purpose language well-suited for systems programming. The document outlines C program structure, comments, variables, constants, I/O, operators, branching with if/else and switch statements, and looping with for loops.
C Tutorial, Clanguage,
C Programming Tutorial
C - Home
C - Overview
C - Environment Setup
C - Program Structure
C - Basic Syntax
C - Data Types
C - Variables
C - Constants
C - Storage Classes
C - Operators
C - Decision Making
C - Loops
C - Functions
C - Scope Rules
C - Arrays
C - Pointers
C - Strings
C - Structures
C - Unions
C - Bit Fields
C - Typedef
C - Input & Output
C - File I/O
C - Preprocessors
C - Header Files
C - Type Casting
C - Error Handling
C - Recursion
C - Variable Arguments
C - Memory Management
C - Command Line Arguments
This document provides an overview of the C programming language. It discusses that C was developed in 1972 by Dennis Ritchie at Bell Labs to write the UNIX operating system. Some key features of C mentioned include it being a procedural language, having a rich library, supporting pointers and recursion. The document also covers C program structure, data types, variables, constants, operators and escape sequences.
CSEG1001Unit 2 C Programming FundamentalsDhiviya Rose
This document provides an overview of the CSEG1001 Computer Programming course. It outlines the topics that will be covered, including generations of computers and languages, C programming basics like variables and data types, decision and looping statements, arrays and strings, functions and pointers, structures and unions. It also describes the steps in the C compilation process of preprocessing, compilation, assembly, and linking. Sample code is provided for Hello World, if/else statements, switch cases, and loops. The document is intended to give engineering students an introduction to C programming concepts.
C was developed by Dennis Ritchie at Bell Labs in 1972. It is a structured, portable, middle-level programming language that uses a top-down approach. A C program consists of functions, with one function named main serving as the starting point. C programs can include comments, preprocessor directives, variables, constants, data types and expressions connected with operators.
This document provides an introduction to the C programming language. It covers C program structure, variables, expressions, operators, input/output, loops, decision making statements, arrays, strings, functions, pointers, structures, unions, file input/output and dynamic memory allocation. The document uses examples and explanations to introduce basic C syntax and concepts.
Data structure & Algorithms - Programming in Cbabuk110
This document discusses programming in C and primitive data types. It covers background on C, the structure of a C program, comments, identifiers, variables, constants, data types, primitive data types like integer, float, void, and the sizeof operator to check the size of data types. It provides examples of variable declarations, constants, escape sequences, and using sizeof.
C was originally developed in the 1970s by Dennis Ritchie at Bell Labs. It is a high-level, general-purpose programming language that contains features allowing it to be used for both system and application programming. The C language consists of characters, numbers, and symbols that form tokens like identifiers, keywords, constants, operators, and punctuation. Variables, functions, and other elements in C are given unique identifiers to represent storage areas that can be manipulated. Constants are values that cannot be altered, and different types of constants like integers, floats, characters, and strings are used. Operators perform operations on values and variables, and different classes of operators exist for arithmetic, assignment, comparison, logic, and other purposes.
This document provides an introduction to C++ programming including problem solving skills, software evolution, procedural and object oriented programming concepts, basic C++ programs, operators, header files, conditional statements, loops, functions, pointers, structures and arrays. It discusses topics such as analyzing problems, planning algorithms, coding solutions, evaluating results, procedural and object oriented paradigms, inheritance, polymorphism, flowcharts, basic syntax examples, and more. Various examples are provided to illustrate key concepts in C++.
This document provides an overview of the Structured Programming Language course offered at Notre Dame University in Bangladesh. The course covers topics such as programming language definition, the history of the C programming language, flow charts, pseudo code, control structures, decision making, operators, data types, variables, constants, and identifiers. It is presented by Stein Joachim Rebeiro, Zubayer Farazi, and Raisa Fabiha for Professor Abul Hasnat Md. Saiful Islam's Computer Science department.
The document provides an introduction to C programming, covering topics such as what a program is, programming languages, the history of C, and the development stages of a C program. It discusses the key components of a C program including preprocessing directives, the main function, and program layout. Examples are provided to illustrate C code structure and the use of variables, keywords, operators, input/output functions, and formatting output with printf.
The document provides an overview of logic constructs and programming styles in C programming. It discusses sequence, selection, and iteration constructs. Sequence constructs execute statements in order. Selection constructs like if-else statements allow a program to make decisions by choosing which statements to execute based on conditions. Iteration constructs like for loops allow repetitive execution of a block of code. The document uses examples and flowcharts to illustrate these core logic constructs in C programming.
This document provides an overview of programming concepts like algorithms, flowcharts, pseudocode, and the C programming language. It discusses topics such as programming, variables, data types, input/output functions, and more. Code samples and definitions are provided to illustrate key concepts in learning to program.
This document provides an introduction to programming in C. It discusses various data types in C like int, char, float, and double. It also covers variable declaration, constants of different types, pointers, and the structure of a basic C program. The key aspects covered are the need to declare variable types, valid identifiers, basic data types and type qualifiers, use of comments and proper indentation for readability.
C was originally developed in the 1970s by Dennis Ritchie at Bell Labs. It is a high-level, general-purpose programming language that contains features allowing it to be used for both system and application programming. The C language consists of characters, numbers, and symbols that form tokens like identifiers, keywords, constants, operators, and punctuation. Variables, functions, and other elements in C are given unique identifiers to represent storage areas that can be manipulated. Constants are values that cannot be altered, and different types of constants like integers, floats, characters, and strings are used. Operators perform operations on values and variables, and different classes of operators exist for arithmetic, assignment, comparison, logic, and other purposes.
Similar to Programming for Problem Solving Unit 2 (20)
The document provides instructions for using various features in Microsoft PowerPoint 2016, including how to design templates and themes, customize templates, insert plugins and add-ins, and add animations. It also lists an activity for creating a PowerPoint presentation with different layouts, applying and customizing themes, and playing the slideshow in various modes.
The document discusses the functions of an operating system. It begins by defining an operating system as a program that controls application execution and acts as an interface between applications and hardware. It then outlines the main functions of an operating system:
1. User interface management, including graphical (GUI) and command line (CUI) interfaces.
2. Program management, which helps manage running programs, system calls, and data sharing between programs.
3. Resource management, which establishes coordination between hardware devices and allows applications to access hardware through device drivers.
4. Memory management, which organizes files and storage, and handles file names and directories.
5. Process management, which deals with running processes
Module 2 Digital Devices and its ApplicationsDhiviya Rose
This document provides an overview of operating systems and their functions. It discusses various types of operating systems including batch processing, multiprogramming, multitasking, and multiprocessing. Batch processing involves processing jobs sequentially without switching between tasks. Multiprogramming allows multiple programs to run concurrently by switching between them. Multitasking operating systems allow a single user to run multiple programs simultaneously. Multiprocessing uses multiple processors to work on multiple programs in parallel. The document also covers the main functions of operating systems like resource management, memory management, and process management.
This document provides an overview of different types of software, including system software and applications software. It discusses operating systems and utility programs as examples of system software, which manages hardware so that applications software can perform tasks. Examples of applications software covered include spreadsheets like Excel, presentation software like PowerPoint, word processors, browsers, and database management systems like Microsoft Access.
The document outlines the course content for DSIT1001 Business Computing. It covers introductions to computer systems, Microsoft Office packages, networks, programming, and analysis/accounting software. Key topics include computer organization, types of computers and software, Windows, networking basics and risks, programming logic and languages, and SPSS/Tally software.
Module 1 - Digital Devices and its ApplicationDhiviya Rose
This document provides an overview and outline of the CLNL 1002 Digital Devices and its Application course. The course covers topics such as basic computer organization, input and output devices, storage devices, various types of software, operating systems, introduction to MS Office packages, internet basics, and introduction to legal databases. It includes lectures on computer organization, hardware components, input/output devices, storage devices, and software. The lectures cover concepts like computer components, central processing unit, memory, storage types, software types, operating systems, and applications of technology.
The document discusses arrays and string operations in C programming. It defines arrays as structures that hold related data items of the same type. It covers one-dimensional and two-dimensional arrays, including declaring, initializing, accessing, and manipulating array elements. It also defines strings as sequences of characters stored as character arrays terminated with a null character. It discusses string declaration, input/output, and standard library functions for determining string length and manipulating strings.
This document discusses structures and unions in C programming. It defines structures as a way to group dissimilar data types and define a new data type. Structures use the struct keyword and allow defining custom data types. Unions are similar to structures but can only store one data element at a time, with storage size equal to the largest member. The document provides examples of declaring and defining structures and accessing structure members using dot and arrow operators. It also discusses static and extern storage classes.
CSEG1001 Lecture 1 Introduction to ComputersDhiviya Rose
This document outlines the course CSEG1001 Computer Programming. It covers several topics that will be taught over the course including the evolution of computers from the abacus to modern devices, generations of computers, programming languages, and basic programming concepts like algorithms, flowcharts, and pseudocode. The course roadmap shows it will cover introduction to computers, C programming basics, arrays and strings, functions and pointers, structures and unions.
The document provides an overview of internet and web basics. It discusses:
- Early network history from the 1980s of point-to-point connections and bulletin boards.
- The development of wide-area networks (WANs) by the Department of Defense in the 1960s-1990s that eventually became the Internet.
- The creation of networking standards like local-area networks (LANs) and metropolitan-area networks (MANs) to allow information to move between businesses.
- Common network topologies like bus, star, and ring and their defining characteristics.
- Key components that make the world wide web functional like uniform resource locators (URLs), hypertext markup
The document discusses string operations in C, defining strings as arrays of characters with a null terminator, and covering functions for declaring, initializing, inputting, manipulating, comparing, searching, and copying strings using standard library functions like strlen(), strcpy(), strcmp(), strchr(), and more. It provides examples of using these string functions to declare, compare, concatenate, and copy strings in C code.
This document discusses representing student test score data using a two-dimensional array in C programming. It explains that a 2D array can model a class of students with multiple test scores by having one dimension represent the student and the other represent the test number. The document provides examples of declaring, initializing, and accessing elements in a 2D array. It also presents exercises for finding the average of all scores and finding the maximum score in the 2D array.
This document discusses two algorithms for searching arrays: linear search and binary search. Linear search simply checks each element of the array sequentially to find a target value, while binary search relies on the array being sorted and checks elements in a divide-and-conquer manner by repeatedly dividing the search space in half. The document provides pseudocode to illustrate how binary search works and compares the advantages of each approach.
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
3. Road Map
• Generations of Computers and Languages
• Organization of Computers-Online Lecture
• Number Systems Conversion
• Logical Analysis and Thinking
Introduction to
Computers
• Structure of C Program & Compilation and Linking Process
• Variables and Datatypes
• Managing Input and Output statements and Operators
• Decision and Looping Statements
C Programming
Basics
• Creation and Usages
• 1D and 2 D arrys
• String Functions
• Matrix operations
Arrays and
Strings
• Declaration and Definitions of Functions
• Passing Arguments
• Recursion
• Pointers & Pointer Arithmetic
Functions and
Pointers
• Need of Structure and Unions
• Declaration and Definition
• Storage classes
• Preprocessor Directives
Structures and
Unions
CSEG1003 Programming for Problem
Solving
4. Online Lecture
• Problem Formulation
• Problem Solving
• Introduction to C
CSEG1003 Programming for Problem
Solving
5. LECTURE #8
STRUCTURE OF C PROGRAM ..COMPILATIONAND
LINKING
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1003 Programming for Problem
Solving
8. Structured Blocks -> Functions
• Solves a large problem
• divides the problem into smaller
modules called functions
• each have particular responsibility.
• The program which solves the
entire problem is a collection of
such functions.
• Types
• Built-in Functions (Predefined)
• E.g. printf(), scanf()
• User-defined Functions
CSEG1003 Programming for Problem
Solving
10. Example Program 2
#include<stdio.h> PREPROCESSOR DIRECTIVE
void myline(); FUNCTION DECLARATION
void main()
{
printf("Hello");
myline(); FUNCTION CALL
}
void myline()
{
printf("this is my function"); FUNCTION DEFINITION
}
10Instructor: Dhiviya Rose J , AP-Sr. Scale | CIT
11. Functions Example 3
CSEG1003 Programming for Problem
Solving
OUTPUT ?????
Function Call ????
Function definition???
Function Declaration????
12. Main Function
CSEG1003 Programming for Problem
Solving
• When system is executed it calls the main function
• Entry point of any program
• Can have void main(){……}
• where it return type is void
• Or can be int main(){……… return 0;}
• where it returns an integer.
13. Steps in C compilation
CSEG1003 Programming for Problem Solving
14. Files in a C program
CSEG1003 Programming for Problem
Solving
Binary Format
a.out ./ <obj file>
17. Documentation
• Comments
• provide clarity to the C source code and allows others to better
understand
• helps in debugging the code.
• Two types
• Single Line //
• Multiline /* any text */
// This is my first Program
/* Written for Engineering students of Petroleum University for the batch
2018-1019 students */
#include <stdio.h>
void main()
{
printf(“Hello”);
}
CSEG1003 Programming for Problem
Solving
18. Preprocessing
• First stage of compilation
• Lines starting with a # character are interpreted by the
preprocessor as preprocessor commands.
• This language is used to reduce repetition in source code
• Print the result of the preprocessing stage, pass the -E
option to gcc:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
CSEG1003 Programming for Problem
Solving
20. LECTURE #9
VARIABLES, CONSTANTS, DATATYPESAND
OPERATORS
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1003 Programming for Problem
Solving
21. Knowledge Checks
#include <stdio.h>
void solveMeFirst( )
{
int num1,num2;
scanf("%d %d",&num1,&num2);
int sum;
sum = num1+num2;
printf("%d",sum);
}
void main()
{
________________Fill me
}
CSEG1003 Programming for Problem
Solving
22. Knowledge Check
• C Program Specification
• 3 user defined functions
• F1 -> prints “I am F1”
• F2 -> prints “I am F2”
• F3 -> prints “I am F3”
• Required Output
I am F2
I am F3
I am F1
I am F2
CSEG1003 Programming for Problem
Solving
23. Keywords
• C has a set of 32 reserved words often known as
keywords.
• All keywords are basically a sequence of characters
that have a fixed meaning.
• By convention all keywords must be written in
lowercase (small) letters.
• Example: for, while, do-while, auto break, case, char,
continue, do, double, else, enum, extern, float, goto,
if, int, long, register, return, short, signed, sizeof,
static, struct, switch, typedef, union, unsigned, void,
volatile
CSEG1003 Programming for Problem
Solving
24. Identifiers
• Identifiers are names given to program elements such as
variables, arrays and functions.
• Rules for forming identifier name
• it cannot include any special characters or punctuation marks (like #,
$, ^, ?, ., etc) except the underscore"_".
• There cannot be two successive underscores
• Keywords cannot be used as identifiers
• The names are case sensitive. So, example, “FIRST” is different from
“first” and “First”.
• It must begin with an alphabet or an underscore.
• It can be of any reasonable length. Though it should not contain more
than 31 characters.
• Example: roll_number, marks, name, SAP_ID, COURSE,
SEM
CSEG1003 Programming for Problem
Solving
25. Variables
• Meaningful name given to the data storage location in
computer memory.
• C language supports two basic kinds of variables.
• Numeric variables can be used to store either integer values or
floating point values.
• While an integer value is a whole numbers without a fraction part or
decimal point, a floating point number, can have a decimal point in
them.
• Numeric values may also be associated with modifiers like short, long,
signed and unsigned.
• By default, C automatically a numeric variable signed..
• Character variables can include any letter from the alphabet or from
the ASCII chart and numbers 0 – 9 that are put between single
quotes.
CSEG1003 Programming for Problem
Solving
27. Knowledge Check - Output????
CSEG1003 Programming for Problem
Solving
28. Knowledge Check - Output????
CSEG1003 Programming for Problem
Solving
29. DataType in C language
CSEG1003 Programming for Problem
Solving
30. Variable Declaration / Definition
• Declaring/Definition a Variable
• Declaration announces the data type of a variable and allocates
appropriate memory location.
• Each variable used must be declared.
• A form of a declaration statement is
data-type var1, var2,…;
Examples
int sum = 0;
char t1 = ‘a’;
float epsilon = 1.44;
CSEG1003 Programming for Problem
Solving
31. Possible ways of Variable Declaration
CSEG1003 Programming for Problem
Solving
35. Global and Local Variables
• Global Variables
• These variables are
declared outside all
functions.
• Life time of a global
variable is the entire
execution period of the
program.
• Can be accessed by any
function defined below the
declaration, in a file.
• Local Variables
• These variables are
declared inside some
functions.
• Life time of a local
variable is the entire
execution period of the
function in which it is
defined.
• Cannot be accessed by any
other function.
• In general variables
declared inside a block are
accessible only in that
block.
CSEG1003 Programming for Problem Solving
37. Constants
• Constants are identifiers whose value does not
change.
• To declare a constant, precede the normal variable
declaration with const keyword and assign it a value.
For example,
const float pi = 3.14;
• Another way to designate a constant is to use the pre-
processor command define.
#define PI 3.14159
CSEG1003 Programming for Problem
Solving
38. Operators in C
• C language supports a lot of operators to be used in
expressions. Includes
• Arithmetic operators
• Relational Operators
• Equality Operators
• Logical Operators
• Unary Operators
• Conditional Operators
• Bitwise Operators
• Assignment operators
• Comma Operator
• Sizeof Operator
CSEG1003 Programming for Problem
Solving
40. Logical and Unary
• Logical operators
• Logical AND (&&)
• Logical OR (||)
• Logical NOT (!).
• As in case of arithmetic expressions, the logical
expressions are evaluated from left to right.
• Unary operators
• act on single operands.
• Three unary operators
• unary minus(-)
• Increment(++)
• Decrement operators(--)
CSEG1003 Programming for Problem
Solving
41. Conditional Operator
• (?:) is just like an if .. else statement
• Syntax of the conditional operator is
exp1 ? exp2 : exp3
• Eg.
large = ( a > b) ? a : b
• Conditional operator is also known as ternary
operator as it is neither a unary nor a binary operator;
it takes three operands.
CSEG1003 Programming for Problem
Solving
42. Bitwise and Bitwise Shift Operators
• Bitwise operators perform operations at bit level.
• bitwise AND operator (&)
• bitwise OR operator (|)
• bitwise NOT (~)
• bitwise XOR operator (^)
• In bitwise shift operations, the digits are moved, or shifted,
to the left or right.
• Left Shift unsigned (<<)
int x = 11000101;
x << 2 = 00010100
• Right arithmetic shift (>>)
int x = 11000101;
x >> 2 = 00110001
CSEG1003 Programming for Problem
Solving
44. Assignment, Comma Operator
CSEG1003 Programming for Problem
Solving
equal sign (=) is the fundamental assignment operator, C also supports
other assignment operators that provide shorthand ways to represent
common variable assignments.
Comma separated operands when chained together are evaluated in left-
to-right sequence with the right-most value yielding the result of the
expression.
45. Sizeof operator
• sizeof is a unary operator used to calculate the sizes
of data types.
• sizeof(char) returns 1, that is the size of a character
data type.
int a = 10;
int result;
result = sizeof(a);
then result = 2,
CSEG1003 Programming for Problem
Solving
47. LECTURE #10
INPUTAND OUTPUT STATEMENTS
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1003 Programming for Problem
Solving
48. OUTPUT STATEMENT - printf()
• printf() function
• Output to Standard Output
• Prototype definition available in stdio.h
CSEG1003 Programming for Problem Solving
49. • Case 1: printing only text
Flowchart code Output
printf(“Hello”); Hello
• Case 2: printing only value of a variable
printf(“%d” , area); 120
• Case 3: printing text and a value
printf(“The value of area is %d”,area); The value of area is 120
Print Hello
Print area
OUTPUT STATEMENT - printf()
CSEG1003 Programming for Problem
Solving
50. INPUT STATEMENT – scanf()
• Case 1: getting 1 input value
scanf( “%d”, &r);
• Case 2: getting 2 input value
scanf( “%d %d ”, &l, &b);
• Case 3: getting 3 input value
scanf( “%d %d %d ”, &a, &b ,&c);
CSEG1003 Programming for Problem
Solving
51. • scanf() function
• Input from Standard Input
• Prototype definition available in stdio.h
• Format Specifier(%d)
• Address-of Operator (&)
• Provides the memory address of the input variable were the input value is to
be stored
CSEG1003 Programming for Problem Solving
55. List of Decision Making Structures in C
•If structure
•If Else structure
•Nested If structure
•Switch Structures
•Conditional Operator/
Terniary operator
CSEG1003 Programming for Problem
Solving
56. Converting a if block to C program
CSEG1003 Programming for Problem
Solving
if(condition)
{
//true statements
}
57. Check if entered number is positive
CSEG1003 Programming for Problem
Solving
58. Converting a if-else block to C program
CSEG1003 Programming for Problem
Solving
if(condition)
{
//true statements
}
else
{
//false statements
}
59. Example: If Else Statement
CSEG1003 Programming for Problem
Solving
60. Knowledge Checks – Implement – If… Else
CSEG1003 Programming for Problem
Solving
61. Nested IF
CSEG1003 Programming for Problem
Solving
if(condition 1)
{
//true statements
}
else if(condition 2)
{
//statements
}
else if(condition 3)
{
//statements
}
else
{
//statements
}
64. Switch Case
• Keywords used switch, case, default, break
• An value is passed as the input
• Switch(value)
• Evaluates with an value in each case
• Case 1:
• Case ‘A’:
• Default:
• Break is used to get exit from switch block
• Break;
CSEG1003 Programming for Problem
Solving
65. Convert Switch to C program
CSEG1003 Programming for Problem
Solving
66. Switch case Vs Nested IF
CSEG1003 Programming for Problem
Solving
69. EXPERIMENT NO – 4
Control Statements in C Language
List of lab works:
1. Write a program to accept 3 numbers and find the greatest of them, using
if…….else statements.
2. Write a program to find the biggest of 3 numbers using conditional operator/ternary
operator?
3. Write a program to check whether the roots of a quadratic equation are real or
imaginary?
4. Program to find the average of students marks, if average<50 then result is ‘FAIL’
otherwise print the grade as pass /first class/distinction.
5. A book and stationary store decides to give its customers 10% discount on a
purchase greater than 10,000/-. The program should accept the quantity
purchased the price of the items and then calculate the amount payable. Further
based on the total amount, appropriate discount should be given and final payable
amount should be displayed.
6. Write a program to accept a number and display “Sunday/Monday/Tuesday…..”
Based on the number. (hint: if 1 is input then “Sunday”, if 2 is input then
“Monday”…..) using switch case.
7. Read the minutes from the keyboard and find out the no. of hours, mins , days ?
(Ex 1210 mins are displayed as 0 days,20 hrs,10 min)
CSEG1003 Programming for Problem
Solving
71. LECTURE #13
LOOP STRUCTURES IN C
Instructor
Dhiviya Rose J . Asst. Prof. Senior Scale
School of Computer Science and Engineering | UPES
CSEG1003 Programming for Problem
Solving
72. Introduction - Loop Statements
• Helps in executing a statement in flowchart repeatedly
• Loop statements – block of statement executed more
than one time
• How many times the loop statements are executed is
managed by a counter variable
• Counter Variable Initialization
• Eg. C=0
• Counter Variable Increment/Decrement
• Eg. C++, c=c+1,c=c+3
• Counter Variable Condition Check
• Eg. C<3
CSEG1003 Programming for Problem
Solving
73. List of Loop Structures in C
• While
• Do….While
• For
CSEG1003 Programming for Problem
Solving
85. EXPERIMENT NO – 5
Loop Statements in C Language
List of lab works:
1. Write a program to print half pyramid using *.
2. Write a C program to print all natural numbers from 1-n
using while loop.
3. Write a C program to find the sum of all even numbers
between 1 to n using do-while loop.
4. Write a C program to print multiplication table of any
number using for loop.
CSEG1003 Programming for Problem
Solving
88. 1. I = scanf("%d%d",&a,&b); value of I will be
2. I = sizeof(float); the value of I will be
3. i=printf("%d",20000); then i=?
4. i=printf("upes"); then i= ?
5. i=scanf("%d",&a); then i=?
CSEG1003 Programming for Problem
Solving
89. 6. i=printf("%d",20000); then i=?
7. printf("%d",printf("%d",345)); the output of the
statement will be ?
8. printf(“%d”,’A’);
9. printf("%o",12); the output of the statement will be ?
10. printf("%d",2&2); the output of the statement will
be ?
11. printf("%.2f",78.34567);
CSEG1003 Programming for Problem
Solving
95. Question 5
void anyFun(int a)
{
if(a==0)
return;
printf("Value is not Zero.");
}
void main()
{
anyFun(0);
}
96. Question 6
#include <stdio.h>
void fun(int a,int b)
{
a+=10;
b+=10;
}
int main()
{
int val1=10;
int val2=10;
printf("nValue before function calling : %d, %d",val1,val2);
fun(val1,val2);
printf("nValue after function calling : %d, %d",val1,val2);
return 0;
}
97. Question 7
#include <stdio.h>
void fun1(void)
{
void fun2(void); /*another function declaration*/
printf("nI am fun1");
fun2();
}
int main()
{
fun1();
return 0;
}
void fun2(void)
{
printf("nI am fun2");
}