These problems are so common that you will find in any C learning curriculum. Either in your college or in any IT institute.
I have provided solutions to these problems as well.
Happy learning...
Practical write a c program to reverse a given numberMainak Sasmal
This document contains code snippets for various C programming problems and their solutions. Some of the problems addressed include:
1. Writing programs to reverse a number, check if a number is palindrome, and find the smallest of three numbers.
2. Programs to calculate the sum of a series, find the average of numbers, and count vowels and consonants in a string.
3. Additional examples show how to determine prime numbers, calculate the sum of a squared series, find the largest number in an array, and calculate factorials.
4. Other solutions demonstrate checking if a number is odd or even, determining if a character is a vowel, checking for a leap year, and calculating the highest common
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
This C program allows a user to answer multiple choice questions (MCQs) and checks their answers. It prints out 5 questions, each with 3 possible answers, and prompts the user to enter the number of the correct answer. It then checks each submitted answer and prints whether it is true or false. This allows the program to automatically grade a short quiz consisting of basic MCQs.
Practical write a c program to reverse a given numberMainak Sasmal
This document contains code snippets for various C programming problems and their solutions. Some of the problems addressed include:
1. Writing programs to reverse a number, check if a number is palindrome, and find the smallest of three numbers.
2. Programs to calculate the sum of a series, find the average of numbers, and count vowels and consonants in a string.
3. Additional examples show how to determine prime numbers, calculate the sum of a squared series, find the largest number in an array, and calculate factorials.
4. Other solutions demonstrate checking if a number is odd or even, determining if a character is a vowel, checking for a leap year, and calculating the highest common
The document provides examples of basic C programs that demonstrate fundamental programming concepts like printing values, arithmetic operations, arrays, functions, conditionals, loops, and matrices. The programs cover topics such as printing and reading integers, adding/multiplying numbers, swapping values, checking vowels/consonants, Armstrong numbers, palindromes, summing matrices, and finding the transpose of a matrix.
This document contains some programs of C using Data structures, like Stack, LinkedList, queue, Fibonacci series, addition and multiplication of two matrices,etc.
This C program asks the user to input a year and then uses conditional statements to check if it is a leap year or not. It checks if the year is divisible by 400, then 100, then 4, outputting whether it is a leap year or not based on the results of these checks.
The document contains 10 programming problems related to basic C concepts like data types, operators, functions, arrays, pointers etc. Each problem has the code to solve it along with sample input/output. The problems cover topics like number formatting, arithmetic operations using switch case, finding min/max, addition of numbers, matrix operations, string functions and recursion.
Practical write a c program to reverse a given numberMainak Sasmal
This document contains code snippets for various C programming problems and their solutions. Some of the problems addressed include:
1. Writing programs to reverse a number, check if a number is palindrome, and find the smallest of three numbers.
2. Programs to calculate the sum of a series, find the average of numbers, and count vowels and consonants in a string.
3. Additional examples show how to determine prime numbers, calculate the sum of a squared series, find the largest number in an array, and calculate factorials.
4. Other solutions demonstrate checking if a number is odd or even, determining if a character is a vowel, checking for a leap year, and calculating the highest common
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
This C program allows a user to answer multiple choice questions (MCQs) and checks their answers. It prints out 5 questions, each with 3 possible answers, and prompts the user to enter the number of the correct answer. It then checks each submitted answer and prints whether it is true or false. This allows the program to automatically grade a short quiz consisting of basic MCQs.
Practical write a c program to reverse a given numberMainak Sasmal
This document contains code snippets for various C programming problems and their solutions. Some of the problems addressed include:
1. Writing programs to reverse a number, check if a number is palindrome, and find the smallest of three numbers.
2. Programs to calculate the sum of a series, find the average of numbers, and count vowels and consonants in a string.
3. Additional examples show how to determine prime numbers, calculate the sum of a squared series, find the largest number in an array, and calculate factorials.
4. Other solutions demonstrate checking if a number is odd or even, determining if a character is a vowel, checking for a leap year, and calculating the highest common
The document provides examples of basic C programs that demonstrate fundamental programming concepts like printing values, arithmetic operations, arrays, functions, conditionals, loops, and matrices. The programs cover topics such as printing and reading integers, adding/multiplying numbers, swapping values, checking vowels/consonants, Armstrong numbers, palindromes, summing matrices, and finding the transpose of a matrix.
This document contains some programs of C using Data structures, like Stack, LinkedList, queue, Fibonacci series, addition and multiplication of two matrices,etc.
This C program asks the user to input a year and then uses conditional statements to check if it is a leap year or not. It checks if the year is divisible by 400, then 100, then 4, outputting whether it is a leap year or not based on the results of these checks.
The document contains 10 programming problems related to basic C concepts like data types, operators, functions, arrays, pointers etc. Each problem has the code to solve it along with sample input/output. The problems cover topics like number formatting, arithmetic operations using switch case, finding min/max, addition of numbers, matrix operations, string functions and recursion.
This document contains 27 C programming examples covering basic concepts like input/output, arithmetic operations, conditional statements, loops, functions, data types, arrays, strings, pointers, structures and file handling. Some key programs include:
1. A program to add two integers by taking input from the user and printing the sum.
2. Programs to check if a number is even or odd, find the largest of three numbers, calculate factorials and check if a year is a leap year.
3. Functions to reverse a number, check if a number is a palindrome, and find prime numbers.
4. A calculator program using switch case and programs to print patterns like pyramids and Fibonacci sequences.
The document contains 34 code snippets showing C programming examples using arrays, loops, functions, conditional statements, and other basic programming concepts. The code snippets demonstrate how to:
1) Print messages, take user input, perform basic math operations like addition and averaging numbers
2) Check conditions like even/odd, positive/negative, leap year
3) Use different loops like while, for, do-while to iterate
4) Define and call functions to modularize code for swapping, factorial, Fibonacci series etc.
5) Use one-dimensional arrays to store and process data
This document is the table of contents for a book on C programming. It lists 88 example C programs that are intended to teach C concepts in an evolutionary manner. The programs cover basics like input/output, variables, data types, operators, loops, conditional statements, arrays, functions, pointers, structures, file I/O and more. The programs are presented from simplest to more complex to help programmers learn each new element of the C language.
The document describes a program to calculate the trace and norm of a matrix. It outlines an algorithm that begins by taking input for the order and elements of matrices A and B. It then calculates the sum of elements of each matrix to find their norms. If the matrices are square, it calculates the trace by summing the diagonal elements. The program displays the matrices, their sum, norms and traces.
The document contains 18 code snippets demonstrating solutions to common programming problems. The code snippets include programs to: 1) convert temperature between Celsius and Fahrenheit, 2) find the larger of two numbers, 3) determine if a number is even or odd, and 4) calculate the square of a number. The programs demonstrate a variety of programming concepts like if/else statements, for loops, functions, and more.
This C program takes in an integer from the user and converts it to its binary equivalent. It uses bitwise operators like right shift and AND to extract each bit and check if it is 1 or 0. A loop shifts the number by 31, 30, 29 ... 1, 0 bits and ANDs it with 1 each time to extract the bits, printing 1 for each bit that is 1 and 0 for each bit that is 0, effectively converting the decimal number to its 32-bit binary representation.
The document contains C program code snippets for solving various math and logic problems. These include programs to find roots of a quadratic equation, generate the Fibonacci series, find Armstrong numbers between intervals, check if a number is prime, and convert between binary, decimal and other number bases. It also includes programs to check for palindromes, calculate power of a number using a while loop, and convert decimal numbers to hexadecimal representation.
This document contains source code for 14 programs written in C programming language by Sumant Diwakar as part of a practical file for a Computer Programming Lab course. The programs include conversions between Fahrenheit and Celsius temperatures, checking if a number is a perfect square, sorting numbers in ascending and descending order, checking vowels, calculating factorials, and other numerical calculations and patterns. Each program section contains the source code and output for that program.
The document contains code to calculate the sum of the digits of the factorial of a given number. It initializes an array to store the digits, calculates the factorial iteratively by multiplying by numbers from 1 to the given number, stores the digits in the array, prints out the factorial and calculates the sum of its digits.
The document contains 10 code snippets showing different C programming examples:
1) Swapping two numbers using a third variable and without a third variable.
2) Calculating power of a number.
3) Counting digits of a number using while and for loops.
4) Finding the largest number from user input.
5) Calculating sum of digits of a number using while, for, and recursion.
6) Finding LCM and sum of an infinite GP series.
This document contains a summary of code snippets and programs related to learning C programming. It begins by thanking several people for their support and contains quotes about programming. It then presents over a dozen short programs numbered from 1.1 to 3.16 that demonstrate basic C concepts like printing statements, mathematical operations, conditional statements, loops and functions. Each program is accompanied by a brief description and comments.
The document contains C code snippets for various programming problems including calculating the area of shapes, finding roots of quadratic equations, sorting arrays, matrix multiplication, and more. The last problem is a program to list the names of students who scored over 60% total marks across three subjects, using a structure variable to store student data.
Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
The document contains solutions to questions on loops in C programming. It includes:
- Sample code to demonstrate while, for, and do-while loops with explanations of output
- Solutions to problems involving calculating overtime pay, finding factorials, exponents, ASCII values, Armstrong numbers, and more using various loop structures
- Explanations of parts of for and do-while loops, and statements like break and continue
- Additional problems solved using nested loops to produce patterns, tables, and series calculations
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...DR B.Surendiran .
The document provides an overview of C programming concepts including data types, variables, operators, conditional statements, loops, functions, arrays and more.
It begins with basic explanations and examples of comments, print statements, data types, input/output functions. Next, it covers conditional statements like if-else and examples to check even/odd and prime numbers. Loops like for and while are explained along with examples to iterate, count and print patterns. Other topics include functions, arrays, strings, structures and examples programs for calculations, pattern printing and sorting. Overall, the document serves as a useful reference for learning C programming fundamentals and common programming concepts.
The document contains 20 programs demonstrating various C programming concepts like data types, operators, control structures, functions, arrays, structures, pointers and data structures. Program 1 shows the use of arithmetic operators to add two numbers. Program 2 demonstrates logical operators in an if-else statement to find the greatest of three numbers. Program 3 uses relational operators in an if-else statement to check if a number is even or odd.
The document describes a C program that implements selection sort using pointers and functions. It takes input of array size and elements, calls the selection sort function sel() on the array, and prints the sorted output. The sel() function takes the array, start and end indexes, finds the minimum element in the range and swaps it with the start element, then calls itself recursively to sort the rest.
The document contains C code examples demonstrating various array operations including:
1) Defining and initializing a single dimensional array, printing its elements, and sorting the array using selection sort.
2) Implementing linear and binary search algorithms to search for elements in an array.
3) Defining and initializing a double dimensional (2D) array and printing its elements.
The document contains C code examples for various algorithms and programs including:
1. A program to check if a year is a leap year by checking if the year is divisible by 400, 100, or 4.
2. Code to add the digits of a number by extracting the remainder of successive divisions by 10.
3. Code to convert a decimal number to binary using bitwise operators.
4. Code to store the binary conversion in a string using pointers and dynamic memory allocation.
5. Programs to check for palindrome numbers, print patterns like pyramids and triangles, calculate Fibonacci series with and without recursion, perform linear and binary search of arrays, insert elements into arrays, and sort arrays using
The document contains 14 code snippets that provide solutions to common programming problems in C including: printing patterns like numbers, stars, triangles using loops; finding sum of digits, checking palindrome, Armstrong number; sorting arrays using bubble, selection sort; string operations like concatenation; matrix addition; factorial; checking even-odd; Floyd's triangle. Each code snippet includes the header files, function definitions and main function to accept input, call functions and print output.
The document contains 14 code snippets that provide solutions to common programming problems in C including: printing patterns like numbers, stars, triangles using loops; finding sum of digits, checking palindrome, Armstrong number; sorting arrays using bubble sort, selection sort; string operations like concatenation; matrix addition; factorial calculation; checking even/odd number. Each code snippet includes the header files, function definitions and main function to accept input, call functions and print output.
This document contains 27 C programming examples covering basic concepts like input/output, arithmetic operations, conditional statements, loops, functions, data types, arrays, strings, pointers, structures and file handling. Some key programs include:
1. A program to add two integers by taking input from the user and printing the sum.
2. Programs to check if a number is even or odd, find the largest of three numbers, calculate factorials and check if a year is a leap year.
3. Functions to reverse a number, check if a number is a palindrome, and find prime numbers.
4. A calculator program using switch case and programs to print patterns like pyramids and Fibonacci sequences.
The document contains 34 code snippets showing C programming examples using arrays, loops, functions, conditional statements, and other basic programming concepts. The code snippets demonstrate how to:
1) Print messages, take user input, perform basic math operations like addition and averaging numbers
2) Check conditions like even/odd, positive/negative, leap year
3) Use different loops like while, for, do-while to iterate
4) Define and call functions to modularize code for swapping, factorial, Fibonacci series etc.
5) Use one-dimensional arrays to store and process data
This document is the table of contents for a book on C programming. It lists 88 example C programs that are intended to teach C concepts in an evolutionary manner. The programs cover basics like input/output, variables, data types, operators, loops, conditional statements, arrays, functions, pointers, structures, file I/O and more. The programs are presented from simplest to more complex to help programmers learn each new element of the C language.
The document describes a program to calculate the trace and norm of a matrix. It outlines an algorithm that begins by taking input for the order and elements of matrices A and B. It then calculates the sum of elements of each matrix to find their norms. If the matrices are square, it calculates the trace by summing the diagonal elements. The program displays the matrices, their sum, norms and traces.
The document contains 18 code snippets demonstrating solutions to common programming problems. The code snippets include programs to: 1) convert temperature between Celsius and Fahrenheit, 2) find the larger of two numbers, 3) determine if a number is even or odd, and 4) calculate the square of a number. The programs demonstrate a variety of programming concepts like if/else statements, for loops, functions, and more.
This C program takes in an integer from the user and converts it to its binary equivalent. It uses bitwise operators like right shift and AND to extract each bit and check if it is 1 or 0. A loop shifts the number by 31, 30, 29 ... 1, 0 bits and ANDs it with 1 each time to extract the bits, printing 1 for each bit that is 1 and 0 for each bit that is 0, effectively converting the decimal number to its 32-bit binary representation.
The document contains C program code snippets for solving various math and logic problems. These include programs to find roots of a quadratic equation, generate the Fibonacci series, find Armstrong numbers between intervals, check if a number is prime, and convert between binary, decimal and other number bases. It also includes programs to check for palindromes, calculate power of a number using a while loop, and convert decimal numbers to hexadecimal representation.
This document contains source code for 14 programs written in C programming language by Sumant Diwakar as part of a practical file for a Computer Programming Lab course. The programs include conversions between Fahrenheit and Celsius temperatures, checking if a number is a perfect square, sorting numbers in ascending and descending order, checking vowels, calculating factorials, and other numerical calculations and patterns. Each program section contains the source code and output for that program.
The document contains code to calculate the sum of the digits of the factorial of a given number. It initializes an array to store the digits, calculates the factorial iteratively by multiplying by numbers from 1 to the given number, stores the digits in the array, prints out the factorial and calculates the sum of its digits.
The document contains 10 code snippets showing different C programming examples:
1) Swapping two numbers using a third variable and without a third variable.
2) Calculating power of a number.
3) Counting digits of a number using while and for loops.
4) Finding the largest number from user input.
5) Calculating sum of digits of a number using while, for, and recursion.
6) Finding LCM and sum of an infinite GP series.
This document contains a summary of code snippets and programs related to learning C programming. It begins by thanking several people for their support and contains quotes about programming. It then presents over a dozen short programs numbered from 1.1 to 3.16 that demonstrate basic C concepts like printing statements, mathematical operations, conditional statements, loops and functions. Each program is accompanied by a brief description and comments.
The document contains C code snippets for various programming problems including calculating the area of shapes, finding roots of quadratic equations, sorting arrays, matrix multiplication, and more. The last problem is a program to list the names of students who scored over 60% total marks across three subjects, using a structure variable to store student data.
Let us C (by yashvant Kanetkar) chapter 3 SolutionHazrat Bilal
The document contains solutions to questions on loops in C programming. It includes:
- Sample code to demonstrate while, for, and do-while loops with explanations of output
- Solutions to problems involving calculating overtime pay, finding factorials, exponents, ASCII values, Armstrong numbers, and more using various loop structures
- Explanations of parts of for and do-while loops, and statements like break and continue
- Additional problems solved using nested loops to produce patterns, tables, and series calculations
Computer programming subject notes. Quick easy notes for C Programming.Cheat ...DR B.Surendiran .
The document provides an overview of C programming concepts including data types, variables, operators, conditional statements, loops, functions, arrays and more.
It begins with basic explanations and examples of comments, print statements, data types, input/output functions. Next, it covers conditional statements like if-else and examples to check even/odd and prime numbers. Loops like for and while are explained along with examples to iterate, count and print patterns. Other topics include functions, arrays, strings, structures and examples programs for calculations, pattern printing and sorting. Overall, the document serves as a useful reference for learning C programming fundamentals and common programming concepts.
The document contains 20 programs demonstrating various C programming concepts like data types, operators, control structures, functions, arrays, structures, pointers and data structures. Program 1 shows the use of arithmetic operators to add two numbers. Program 2 demonstrates logical operators in an if-else statement to find the greatest of three numbers. Program 3 uses relational operators in an if-else statement to check if a number is even or odd.
The document describes a C program that implements selection sort using pointers and functions. It takes input of array size and elements, calls the selection sort function sel() on the array, and prints the sorted output. The sel() function takes the array, start and end indexes, finds the minimum element in the range and swaps it with the start element, then calls itself recursively to sort the rest.
The document contains C code examples demonstrating various array operations including:
1) Defining and initializing a single dimensional array, printing its elements, and sorting the array using selection sort.
2) Implementing linear and binary search algorithms to search for elements in an array.
3) Defining and initializing a double dimensional (2D) array and printing its elements.
The document contains C code examples for various algorithms and programs including:
1. A program to check if a year is a leap year by checking if the year is divisible by 400, 100, or 4.
2. Code to add the digits of a number by extracting the remainder of successive divisions by 10.
3. Code to convert a decimal number to binary using bitwise operators.
4. Code to store the binary conversion in a string using pointers and dynamic memory allocation.
5. Programs to check for palindrome numbers, print patterns like pyramids and triangles, calculate Fibonacci series with and without recursion, perform linear and binary search of arrays, insert elements into arrays, and sort arrays using
The document contains 14 code snippets that provide solutions to common programming problems in C including: printing patterns like numbers, stars, triangles using loops; finding sum of digits, checking palindrome, Armstrong number; sorting arrays using bubble, selection sort; string operations like concatenation; matrix addition; factorial; checking even-odd; Floyd's triangle. Each code snippet includes the header files, function definitions and main function to accept input, call functions and print output.
The document contains 14 code snippets that provide solutions to common programming problems in C including: printing patterns like numbers, stars, triangles using loops; finding sum of digits, checking palindrome, Armstrong number; sorting arrays using bubble sort, selection sort; string operations like concatenation; matrix addition; factorial calculation; checking even/odd number. Each code snippet includes the header files, function definitions and main function to accept input, call functions and print output.
The document contains 24 C programming examples demonstrating various programming concepts like input/output, arithmetic operations, conditional statements, loops, functions, strings, arrays and matrices. The examples include programs to calculate sum and average, area of shapes, simple and compound interest, employee salary calculation, swapping values, finding largest number, checking vowels, printing tables, factorials, reversing numbers, string operations and matrix addition.
The document provides code snippets to copy the contents of one array into another array in reverse order using different approaches like loops, pointers, and functions. It also includes code to reverse an array without using additional memory by swapping elements, and to reverse an array using pointers.
The document contains C code for 17 different programs that perform various mathematical and logical operations:
1) Addition of two numbers
2) Multiplication of two numbers
3) Check if a number is positive or negative
4) Check if a number is even or odd
5) Find the maximum of two numbers
6) Find the maximum of three numbers
7) Calculate the sum of the first n numbers
8) Reverse a number
9) Print the multiplication table of a number
10) Calculate ab (power of a number)
11) Calculate the factorial of a number
12) Print the Pascal's triangle
13) Check if a number is a perfect number
14) Find the
The document contains source code for several programs written in C programming language. The programs include: converting temperature between Fahrenheit and Celsius, checking if a number is a perfect square, arranging numbers in ascending and descending order, checking uppercase characters for vowels using switch statement, finding the factorial of a number, finding the sum of numbers between 100-200 divisible by 7, checking if a number is prime or composite, finding the average of five numbers, finding the biggest and smallest number from a list, finding the sum of digits in a number, generating the Fibonacci series, displaying patterns using loops, finding the factorial of a number using recursion, printing an identity matrix, and finding the addition and multiplication of matrices.
This document contains a summary of 14 experiments conducted for the Numerical Analysis and Statistical Techniques lab course. Each experiment involves writing a C program to solve a different numerical problem, such as finding the largest of three numbers, solving quadratic equations, numerical integration using trapezoidal and Simpson's rules, and solving differential equations using numerical methods like Runge-Kutta. For each experiment, the document includes the aim, flowchart, C program code, and sample output.
The document contains 11 questions related to string manipulation and function problems in C programming. For each question, it provides the full source code of a C program that implements the given task. The questions cover topics such as reading and manipulating strings, calculating lengths, reversing strings, copying strings, comparing strings, counting characters, and defining and calling functions to perform operations on integers like addition, multiplication, factorial, prime checking etc.
This document contains an assignment submission for a programming fundamentals course. It includes 8 sections with 2 code examples each demonstrating different programming concepts like printing text, if/else statements, loops, functions, and arrays in C programming language. The codes show basics like finding the sum of two numbers, checking even/odd, generating patterns, finding repeated elements in an array. The assignment was submitted by Zohaib Zeeshan to their professor for the first semester course.
The documents contain program code snippets for various sorting and searching algorithms in C programming language including selection sort, bubble sort, quick sort, merge sort, insertion sort, binary search and linear search. The programs take input from the user, implement the respective algorithms to sort or search arrays of numbers, and output the results.
The document contains examples of various programming tasks in C including checking if a number is even or odd, printing an integer entered by the user, counting the digits of an integer, checking if a character is an alphabet, finding the highest common factor of two numbers, calculating the factorial of a number, finding the number of vowels, consonants, digits and whitespace characters in a string, calculating the length of a string without using the strlen() function, manually copying a string, calculating the sum of natural numbers using while and for loops, displaying the Fibonacci series up to a given number of terms or until a value, and generating a multiplication table for a given number. The examples demonstrate the use of basic programming constructs like if-
This document contains C program code examples for various programming problems. It is divided into 5 weeks. Some of the programs included are: exchanging values between two variables with and without a temporary variable, finding the sum of digits of a positive integer, generating factors of numbers, calculating the factorial of a number, computing the sine function as a series, generating the Fibonacci sequence, reversing digits of an integer, converting decimal to binary, octal and hexadecimal, calculating terms of a series, and performing basic mathematical operations based on user input. The document provides the code and output for each problem.
The document discusses the C programming language. It provides a brief history of C, describes its data types and operators. It then presents 26 sample C programs demonstrating basic concepts like input/output, conditional statements, loops, functions, arrays and strings. The programs cover calculations, pattern printing, factorial, Fibonacci series and other simple programming examples.
The document contains 20 C programs that demonstrate various programming concepts like:
1. Taking input from the user and displaying output
2. Calculating the average, area, power of a number
3. Checking if a number is even/odd, positive/negative
4. Comparing numbers and displaying the largest/smallest
5. Conditional statements like if-else to classify ages, exam scores, leap years
The student requests the teacher to solve the remaining programs in class for learning.
The document provides C code to calculate the sum of three mathematical series: 1) the sum of cubes from 1 to n, 2) the sum of natural numbers from 1 to n, and 3) the sum of squares from 1 to n. For each series, it prints the formula, sample C code to calculate the sum, and sample output. The C code takes the upper limit n as input and uses loops or direct formulae to calculate the sum and output the result.
The document contains C program code snippets for performing various operations on 1D and 2D arrays such as calculating sum and average of elements, printing elements in reverse order, finding elements greater than average, storing elements in reverse order in another array, searching for an element, finding maximum and minimum elements, sorting elements, adding two 2D arrays, printing upper and lower triangles of a matrix, calculating row and column sums, and adding diagonals of a matrix.
This document contains C program code snippets and explanations for various programming problems including:
1) Finding perfect, Armstrong, and prime numbers as well as reversing, summing digits, and checking palindromes of numbers.
2) Converting between decimal and binary, multiplying matrices, and calculating LCM and factorial.
3) Checking for leap years and strong, palindrome, and generic root of numbers.
The document contains 30 programming problems and their solutions in C programming language, ranging from basic programs to calculate sums and patterns to programs involving functions, arrays, and strings. It provides the full source code for each problem and expected output to demonstrate how to write programs to solve common tasks in C. The problems cover a variety of concepts in C like decision making, loops, functions, arrays, strings, structures to help learn and practice basic to intermediate level programming.
This document provides a collection of 30 C programming problems and their solutions to help learn and practice basic C programming concepts. The problems cover topics like input/output, conditional statements, loops, functions, arrays, and strings. Well commented code is provided for each problem to clearly demonstrate how to write programs to solve common tasks in C.
The document discusses various topics related to microprocessors and computer architecture. It begins by providing details about the pins and functions of the 8085 microprocessor. It then discusses interfacing memory chips with the 8085 and provides an example. Next, it describes the block diagram and functions of the different units of the 8086 microprocessor. It also explains the different addressing modes used in 8086 with examples. The document then discusses the control word format for programming the I/O ports of the 8255 chip. In less than 3 sentences.
Windows Script Host is the Host/Execution Environment for different types of scripting languages. WSH officially supports VBScripts JavaScripts through(WScript,CScript). Different types of scripts can execute within the Host Environment with the help of respective Script Engine.
This document discusses different data types in programming. It describes built-in data types like int, char, float, and double that are predefined by languages. It also covers user-defined data types like arrays, pointers, structures, and unions. Finally, it provides details on number data types, listing the memory size, value ranges, and format specifiers for short int, unsigned short int, int, long int, and other numeric types.
A variable is a name given to a memory location that can store a value of a specified data type, such as integer or float, which can be changed during runtime. A constant is similar to a variable but once initialized, its value cannot be changed. Constants are typically defined with a #define statement without an equal sign or semicolon, or with the const modifier and an equal sign for initialization. Both variables and constants must be declared with a data type and can make programs more readable and maintainable by using descriptive names.
Any source code we write will have statements which work as instructions to the CPU. These statements are made of tokens. This Session will cover the concept of tokens.
Computer programming tools and building processArghodeepPaul
The document discusses programming tools and the common building process used to create computer programs. It defines a computer program as a collection of statements written in a programming language. Programming tools like text editors, compilers, assemblers, linkers and debuggers are used to write and build programs. The common building process involves writing source code in a text editor, compiling it to assembly code, assembling to object code, and linking with header files to create an executable file.
Algorithm pseudocode flowchart program notesArghodeepPaul
The document discusses algorithms, pseudocode, flowcharts, and final programs. It defines an algorithm as a step-wise solution to a problem. Pseudocode is similar to a programming language and is based on an algorithm. A flowchart provides a graphical representation of an algorithm using standard symbols. Finally, the algorithm, pseudocode, and flowchart are encoded into an actual program using a programming language like C, Java, or Kotlin.
This document provides an introduction to computer programming concepts, including:
- A computer program is a sequence of instructions written in a programming language to perform a specified task on a computer. Programming languages include Python, Java, C++, and others.
- Computer programming, or coding, involves writing instructions in a programming language for a computer to execute. It allows computers to perform tasks like displaying messages, performing calculations, and more.
- Key elements of programming languages include data types, variables, operators, functions, and control structures like conditionals and loops. These elements are used to write programs to solve problems.
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsVictor Morales
K8sGPT is a tool that analyzes and diagnoses Kubernetes clusters. This presentation was used to share the requirements and dependencies to deploy K8sGPT in a local environment.
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesChristina Lin
Traditionally, dealing with real-time data pipelines has involved significant overhead, even for straightforward tasks like data transformation or masking. However, in this talk, we’ll venture into the dynamic realm of WebAssembly (WASM) and discover how it can revolutionize the creation of stateless streaming pipelines within a Kafka (Redpanda) broker. These pipelines are adept at managing low-latency, high-data-volume scenarios.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
ACEP Magazine edition 4th launched on 05.06.2024Rahul
This document provides information about the third edition of the magazine "Sthapatya" published by the Association of Civil Engineers (Practicing) Aurangabad. It includes messages from current and past presidents of ACEP, memories and photos from past ACEP events, information on life time achievement awards given by ACEP, and a technical article on concrete maintenance, repairs and strengthening. The document highlights activities of ACEP and provides a technical educational article for members.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTjpsjournal1
The rivalry between prominent international actors for dominance over Central Asia's hydrocarbon
reserves and the ancient silk trade route, along with China's diplomatic endeavours in the area, has been
referred to as the "New Great Game." This research centres on the power struggle, considering
geopolitical, geostrategic, and geoeconomic variables. Topics including trade, political hegemony, oil
politics, and conventional and nontraditional security are all explored and explained by the researcher.
Using Mackinder's Heartland, Spykman Rimland, and Hegemonic Stability theories, examines China's role
in Central Asia. This study adheres to the empirical epistemological method and has taken care of
objectivity. This study analyze primary and secondary research documents critically to elaborate role of
china’s geo economic outreach in central Asian countries and its future prospect. China is thriving in trade,
pipeline politics, and winning states, according to this study, thanks to important instruments like the
Shanghai Cooperation Organisation and the Belt and Road Economic Initiative. According to this study,
China is seeing significant success in commerce, pipeline politics, and gaining influence on other
governments. This success may be attributed to the effective utilisation of key tools such as the Shanghai
Cooperation Organisation and the Belt and Road Economic Initiative.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Adaptive synchronous sliding control for a robot manipulator based on neural ...IJECEIAES
Robot manipulators have become important equipment in production lines, medical fields, and transportation. Improving the quality of trajectory tracking for
robot hands is always an attractive topic in the research community. This is a
challenging problem because robot manipulators are complex nonlinear systems
and are often subject to fluctuations in loads and external disturbances. This
article proposes an adaptive synchronous sliding control scheme to improve trajectory tracking performance for a robot manipulator. The proposed controller
ensures that the positions of the joints track the desired trajectory, synchronize
the errors, and significantly reduces chattering. First, the synchronous tracking
errors and synchronous sliding surfaces are presented. Second, the synchronous
tracking error dynamics are determined. Third, a robust adaptive control law is
designed,the unknown components of the model are estimated online by the neural network, and the parameters of the switching elements are selected by fuzzy
logic. The built algorithm ensures that the tracking and approximation errors
are ultimately uniformly bounded (UUB). Finally, the effectiveness of the constructed algorithm is demonstrated through simulation and experimental results.
Simulation and experimental results show that the proposed controller is effective with small synchronous tracking errors, and the chattering phenomenon is
significantly reduced.
Adaptive synchronous sliding control for a robot manipulator based on neural ...
Common problems solving using c
1. Common Problems
Solving using C Language
Instructor:
Arghodeep Paul
Firmware Engineer at BitBible Technologies Pvt. Ltd.
Content Author: Arghodeep Paul
License: OpenSource
Date: 01 August 2021
2. IF ELSE:
1. Check whether the user entered number is positive.
#include<stdio.h>
int main(){
int number;
printf("Enter a number:");
scanf("%d",&number);
if(number>0){
printf("%d is a positive number!",number);
}
else{
printf("%d is a negative number",number);
}
return 0;
}
3. 2. Write a program to check whether a number is even
or odd.
#include<stdio.h>
int main(){
int num;
printf("Enter a number:");
scanf("%d",&num);
if(num%2==0){
printf("%d is an even number!",num);
}
else{
printf("%d is an odd number",num);
}
return 0;
}
4. FOR LOOP:
3. Write a program to display first 10 natural numbers
#include <stdio.h>
int main()
{
int i;
printf("The first 10 natural numbers are:n");
for (i=1;i<=10;i++)
{
printf("%d ",i);
}
printf("n");
return 0;
}
5. 4. Write a program to find biggest among two numbers.
#include<stdio.h>
int main()
{
int n1,n2,sum;
printf("nEnter 1st number : ");
scanf("%d",&n1);
printf("nEnter 2nd number : ");
scanf("%d",&n2);
if(n1 > n2)
printf("n1st number is greatest.");
else
printf("n2nd number is greatest.");
return 0;
}
6. WHILE LOOP:
5. Write a program to display natural numbers upto a
given range.
#include <stdio.h>
int main()
{
int num,i;
printf("Enter a number : ");
scanf("%d", &num);
i = 0;
while (i <= num)
{
printf("n%d",i);
i++;
}
7. return 0;
}
6. Write a program to display sum of first 5 natural
number.
#include <stdio.h>
int main()
{
int num, i, sum = 0;
printf("Enter a positive number : ");
scanf("%d", &num);
i = 0;
while (i <= num)
{
sum = sum + i;
i++;
8. }
printf(" n Sum of first %d natural number is : %d", num,
sum);
return 0;
}
7. Write a program to generate the following series 1 4
9 16 …. 100
#include<stdio.h>
int main()
{
int i;
for(i=1;i<=10;i++)
{
printf("n%d",i*i);
}
return 0;
}
9. 8. Write a program to find out sum of first 10 natural
numbers
int main()
{
int i, sum = 0;
i = 0;
while (i <= 10)
{
sum = sum + i;
i++;
}
printf(" n Sum of first 10 natural number is : %d", sum);
10. return 0;
}
9. Write a program to read 10 numbers and find their
sum and average
#include <stdio.h>
int main()
{
int i,n,sum=0;
float avg;
printf("Input the 10 numbers : n");
for (i=1;i<=10;i++)
{
printf("Number-%d :",i);
scanf("%d",&n);
sum +=n;
}
avg=sum/10.0;
printf("The sum of 10 no is : %dnThe Average
is : %fn",sum,avg);
return 0;
11. }
10. Find cube of the number upto a given integer
#include <stdio.h>
int main()
{
int i,ctr;
printf("Input number of terms : ");
scanf("%d", &ctr);
for(i=1;i<=ctr;i++)
{
printf("Number is : %d and cube of the %d is :%d n",i,i,
(i*i*i));
12. }
return 0;
}
11. Compute multiplication table of a given integer
#include <stdio.h>
int main()
{
int j,n;
printf("Input the number (Table to be calculated) : ");
scanf("%d",&n);
printf("nn");
for(j=1;j<=10;j++)
{
printf("%d X %d = %d n",n,j,n*j);
}
return 9;
}
13. 12. Display n number of multiplication table vertically
#include <stdio.h>
int main()
{
int j,i,n;
printf("Input upto the table number starting from 1 : ");
scanf("%d",&n);
printf("Multiplication table from 1 to %d n",n);
for(i=1;i<=10;i++)
{
for(j=1;j<=n;j++)
{
if (j<=n-1)
printf("%dx%d = %d, ",j,i,i*j);
else
15. // leap year if perfectly divisible by 400
if (year % 400 == 0) {
printf("%d is a leap year.", year);
}
// not a leap year if divisible by 100
// but not divisible by 400
else if (year % 100 == 0) {
printf("%d is not a leap year.", year);
}
// leap year if not divisible by 100
// but divisible by 4
else if (year % 4 == 0) {
printf("%d is a leap year.", year);
}
// all other years are not leap years
else {
printf("%d is not a leap year.", year);
}
return 0;
}
16. 14. Find out the sum of odd numbers upto a given
range.
#include <stdio.h>
int main()
{
int i, n, sum=0;
/* Input range to find sum of odd numbers */
printf("Enter upper limit: ");
scanf("%d", &n);
/* Find the sum of all odd number */
for(i=1; i<=n; i+=2)
{
sum += i;
}
printf("Sum of odd numbers = %d", sum);
return 0;
}
17. 15. Write a program to print the series 0,1,3,6,10 upto
N
#include<stdio.h>
int main()
{
int i,j=1,k=1,n;
printf("nEnter number of terms:");
scanf("%d",&n);
printf("n");
printf(“%dt”,0);
for(i=0;i<n;i++)
{
printf("%dt",k);
j=j+1;
k=k+j;
}
return 0;
}
18. 16. Find factorial of a user given number
#include <stdio.h>
int main()
{
int c, n, f = 1;
printf("Enter a number to calculate its factorial:");
scanf("%d", &n);
for (c = 1; c <= n; c++)
f = f * c;
printf("Factorial of %d = %dn", n, f);
return 0;
}
19. PATTERN:
17. Write a program to generate a pyramid pattern.
#include <stdio.h>
int main() {
int i, space, rows, k = 0;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (i = 1; i <= rows; ++i, k = 0) {
for (space = 1; space <= rows - i; ++space)
{printf(" ");
}
while (k != 2 * i - 1) {
printf("* ");
++k;
}
printf("n");
}
return 0;
}
20. 18. Write a program to generate a ring angle like
pattern with numbers.
#include <stdio.h>
int main() {
int i, j, rows;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (i = 1; i <= rows; ++i)
{for (j = 1; j <= i; ++j) {
printf("%d ", j);
}
printf("n");
}
return 0;
}
21. FUNCTION:
19. Create a user defined function addition() to add
two user input numbers.
#include<stdio.h>
int main() {
int num1, num2, res;
printf("nEnter the two numbers : ");
scanf("%d %d", &num1, &num2);
//Call Function Sum With Two Parameters
res = addition(num1, num2);
printf("nAddition of two number is : %d",res);
return (0);
}
22. int addition(int num1, int num2)
{int num3;
num3 = num1 + num2;
return (num3);
}
20. Find maximum of two numbers entered by user
using function.
#include <stdio.h>
int max(int num1, int num2);
int main()
{
int num1, num2, maximum;
printf("Enter any two numbers: ");
scanf("%d%d", &num1, &num2);
maximum = max(num1, num2);
printf("nMaximum = %dn", maximum);
return 0;
}
int max(int num1, int num2)
23. {
return (num1 > num2 ) ? num1 : num2;
}
21. Find out average of two numbers using function.
#include <stdio.h>
float average(int x, int
y){return (float)(x + y)/2;
}
int main(){
int number1, number2;
float avg;
printf("Enter the first number: ");
scanf("%d",&number1);
printf("Enter the second number: ");
scanf("%d",&number2);
avg = average(number1, number2);
printf("The Average of %d and %d
is: %.2f",number1,number2,avg);
return 0;
}
24. ARRAY:
22. Write a program to store elements in an array and
print.
#include <stdio.h>
void main()
{
int arr[10];
int i;
printf("nnRead and Print elements of an array:n");
printf(" n");
printf("Input 10 elements in the array :n");
for(i=0; i<10; i++)
{
printf("element - %d : ",i);
scanf("%d", &arr[i]);
}
26. 23. Store elements upto n in an array and show in
reversed order.
#include <stdio.h>
#define MAX_SIZE 100
int main()
{
int arr[MAX_SIZE];
int size, i;
printf("Enter size of the array: ");
scanf("%d", &size);
printf("Enter elements in array: ");
for(i=0; i<size; i++)
{
scanf("%d", &arr[i]);
}
printf("nArray in reverse order: ");
for(i = size-1; i>=0; i--)
{
printf("%dt", arr[i]);
}
return 0;
}
27. 24. Find the sum of all elements in an array.
#include <stdio.h>
void main()
{
int a[100];
int i, n, sum=0;
printf("nnFind sum of all elements of array:n");
printf(" n");
printf("Input the number of elements to be stored in the
array :");
scanf("%d",&n);
printf("Input %d elements in the array :n",n);
28. for(i=0;i<n;i++)
{
printf("element - %d : ",i);
scanf("%d",&a[i]);
}
for(i=0; i<n; i++)
{
sum += a[i];
}
printf("Sum of all elements stored in the array is : %dnn",
sum);
}
29. 25. Find out the smallest element in an array.
#include <stdio.h>
int main()
{
int arr[] = {25, 11, 7, 75, 56};
int length = sizeof(arr)/sizeof(arr[0]);
int min = arr[0];
for (int i = 0; i < length; i++) {
//Compare elements of array with min
if(arr[i] < min)
min = arr[i];
}
printf("Smallest element present in given array: %dn", min);
return 0;
}