0% found this document useful (0 votes)
29 views

Coding 2024 25 Final

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Coding 2024 25 Final

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Department of Computer Science and Engineering

Week

Week 1

Week 2

Week 3
Week 4

Week 5

Week 6

Week 7
Week 8

Week 9

Week 10

Week 11

Week 12

Week 13

Week 14
GITAM School of Technology
Department of Computer Science and Engineering
week-wise plan for the coding classes
Semester - VII
Topics to be covered

Overview of Programming Languages:


Introduction to C: History and Features
Setting Up the Development Environment (IDE/Compiler)
Writing and Running Your First C Program
Basic Syntax and Structure of a C Program
Data Types and Variables
Constants and Literals
Basic Input/Output Operations
Control Structures:Operators: Arithmetic, Relational, Logical, Bitwise
Control Statements: if, if-else, nested if
Looping Structures: for, while, do-while
Break, Continue, and Goto Statements

Error Handling and Debugging:


Error Handling in C
errno, perror(), and strerror()
Debugging Techniques
Using gdb for Debugging
Common Programming Errors and Solutions

Functions:
Introduction to Functions
Function Declaration, Definition, and Calling
Scope and Lifetime of Variables
Recursion
Inline Functions
Storage Classes: auto, extern, static, register
Arrays and Strings:
Introduction to Arrays
Single-Dimensional Arrays
Multidimensional Arrays
Strings in C
String Handling Functions
Array of Strings
Arrays and Strings:
Introduction to Arrays
Single-Dimensional Arrays
Multidimensional Arrays
Strings in C
String Handling Functions
Array of Strings
"Pointers:
Introduction to Pointers
Pointer Arithmetic
Pointers and Arrays
Pointers and Strings
Pointers to Pointers
Dynamic Memory Allocation: malloc, calloc, realloc, free

File Handling:
File Operations: Opening, Closing, Reading, Writing
Modes of File Opening
File Pointers
Reading and Writing Binary Files
File Positioning: fseek, ftell, rewind
Error Handling in File Operations
Preprocessor Directives:
Introduction to Preprocessor Directives
Macro Substitution
File Inclusion
Conditional Compilation
Other Preprocessor Directives: #define, #undef, #ifdef, #ifndef, #endif

Data Structures:
Linked Lists: Single, Double, Circular
Operations on Linked Lists: Insertion, Deletion, Traversal
Stacks and Queues: Implementation using Arrays and Linked Lists
Operations on Stacks and Queues

Data Structures and Algorithms:


Sorting Algorithms: Bubble Sort, Selection Sort, Insertion Sort, Merge
Sort, Quick Sort
Searching Algorithms: Linear Search, Binary Search
Data Structures and Algorithms:
Trees: Binary Trees, Binary Search Trees
Tree Traversal: Inorder, Preorder, Postorder

Graphs and Graph Traversals

Greedy Approach - Sample algorithms

Dynamic Programming - sample algorithms

Dynamic Programming - sample algorithms

Branch and Bound and Back tracking

Code review
ineering

Practice Exercises

1) Remove an element: Given an integer array arr and an integer key, write a program in C to return the number of va
key.
2) Remove duplicates from a given array: Given a sorted integer array arr, write a program in C to return the array af
duplicates, with all the other elements in place.
3) Best time to sell a commodity: Given an array of positive integers that represent the price of a commodity on a give
integers which represent the best day to buy and later, sell the commodity.
4) Merging the strings: Given two strings str1 and str2 in two files file1 and file2, write a program to create a third str
character from each array alternatively. If one string is longer than the other, append the extra characters to str3. Write
different text file called file3.
5) String reversal: Given an string with words separated by empty spaces, commas or fullstops, write a program to ret
removing the commas and fullstops and reversing the words in the string.
6) Move all zeros to the end: Given an integer array arr, return the array with all the zeros moved to the end of the arr
ordering of the non-zero lements should not change.
7) Is substring: Given two strings str1 and str2, write a program to return true if str2 is a substring of str1 and false oth
8) Is subsequence: Given two strings str1 and str2, write a program to return true if str2 is a subsequence of str1 and f
9) Maximum value subarray: Given an array of integers arr, return the maximum sum of a subarray (with contiguous
array.
10) Single occurence of a number: Given an array of integers which all numbers but one occuring twice, find the num
only once.
1) Reverse a linked list: Given a linked list, reverse the linked lst and return the pointer to the reversed list.
2) Remove fullstops from a string: Given a string with alphanumeric characters and fullstops, write a program to remo
from the string.
3) Middle of a linked list: Given a singly linked list, find the element at the middle of the linked list.
4) Maximum odd-even sum of a linked list: Given a linkedlist, find the maximum sum sum of pairs of alternate eleme

1) Implement the different sorting algorithms.


2) Peak element of an array: Given an array of n integers, find the first and last peak elements of the array. A number
greater than both its neighbors.
1) Maximum Depth: Given a binary tree, find its maximum depth.
2) Level order traversal: Given the root of a binary tree, return an array with the level order traversal of its nodes' valu
3) Maximum level sum: Given the root of a binary tree, return the smallest level x such that the sum of all the values
is maximal.
4) Deletion from a binary search tree: Given a binary search tree, write a function to delete a key element key from th
the root of the modified tree.
1) Graph Traversals:Given a graph, traverse it in BFS and DFS orders.
2) Number of districts: A map with cities is represented as a graph, where each node represents a city and each edge r
way) road from the city. A district is a group of directly or indirectly connected cities. Given the graph of a country, c
of districts in it.
3) You are given an m x n array where each cell can have 0 (represents an empty cell), 1 (represents a good apple) or
apple). Starting from day1, all the four apples adjacent (top, bottom or diagnol) to each rotten apple also become rotte
1) Duplicate removal: Given a string s, remove duplicate characters such that each character appears only once, such
minimum number of days before which all the apples are rotten? If they never get rotten, return -1.
string is the smallest in terms lexicographical ordering.
2) Task scheduling: You are given an array of jobs to be executed by workers named A to N. Each worker takes one h
job and needs a resting period of n hours before the next job is taken-up. Jobs can be completed in any order. Return
number of hours before which all jobs are completed.
3) Given two integers x and y, return any string str such that str has length x + y and contains exactly x 'x' letters, and
1) Minimum Cost Stairs: Given an integer array price where price[i] is the cost of ith step on a staircase. Once the pri
letters. In addition, str should not contain 'xxx' or 'yyy'.
may climb one or two steps. In addition, she can start from step 0 or step 1. Return the minimum price with which A
top of the floor.
2) Tribonacci number: The Tribonacci sequence Tn is defined as follows:
T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.
Given n, return the value of Tn.
1) Longest Common Subsequence: Given two strings str1 and str2, write a function to return the length of their longe
subsequence. If there is no common subsequence, return 0.
2) Robots: Given an m x n grid and a robot is initially located at the top-left corner (i.e., grid[0][0]), find the number o
that robot can take to reach the bottom right hand corner, if the robot can only move either down or right at any point
3) Edit distance: Given two strings str1 and str2, write a function to return the minimum number of operations require
str2., if the possible operations are to insert, delete or replace a character.
1) Combination sum: Given a number n, find all valid combinations of k numbers that sum up to n such that only num
are used and each number is not used more than once.
2) Phone number to alphabets: Given a string of digits from 2to9, write a function to return all the possible strings tha
represented by the number, as per the folloiwng mapping : 2- abc, 3 - def, 4 - ghi, 5 - jkl, 6 - mno, 7- pqr, 8 - stu, 9- w
GITAM School
Department of Computer
Week Topics to be Covered
Week - wise plan
Week 01 Overview of Programming Languages:
Introduction to C: History and Features
Setting Up the Development Environment
(IDE/Compiler)
Writing and Running Your First C Program
Basic Syntax and Structure of a C Program
Data Types and Variables
Constants and Literals
Basic Input/Output Operations
Week 02 Control Structures:Operators: Arithmetic, Relational,
Logical, Statements:
Control Bitwise if, if-else, nested if
Looping Structures: for, while, do-while
Week 03 Break, Continue, and Goto Statements,
Week 04 Expressions,Conditional Expressions, Precedence and
Functions:
Introduction to Functions
Function Declaration, Definition, and Calling
Scope and Lifetime of Variables
Recursion
Inline Functions
Storage Classes: auto, extern, static, register
Week 05 Arrays and Strings:
Introduction to Arrays
Single-Dimensional Arrays
Multidimensional Arrays
Strings in C
String Handling Functions
Array of Strings
Week 06 Pointers:
Introduction to Pointers
Pointer Arithmetic
Pointers and Arrays
Pointers and Strings
Pointers to Pointers
Dynamic Memory Allocation: malloc, calloc, realloc,
Week 07 free
Structures and Unions:
Introduction to Structures
Defining and Using Structures
Array of Structures
Pointers to Structures
Introduction to Unions
Differences between Structures and Unions
Typedef , Bit-fields
Week 08 File Handling:
File Operations: Opening, Closing, Reading, Writing
Modes of File Opening
File Pointers
Reading and Writing Binary Files
File Positioning: fseek, ftell, rewind
Error Handling in File Operations
Week 09 Preprocessor Directives:
Introduction to Preprocessor Directives
Macro Substitution
File Inclusion
Conditional Compilation
Other Preprocessor Directives: #define, #undef,
Week 10 #ifdef,Structures:
Data #ifndef, #endif
Linked Lists: Single, Double, Circular
Operations on Linked Lists: Insertion, Deletion,
Week 11 Traversal
Stacks and Queues: Implementation using Arrays and
Linked Lists on Stacks and Queues
Operations
Week 12 Error Handling and Debugging:
Error Handling in C
errno, perror(), and strerror()
Debugging Techniques
Using gdb for Debugging
Common Programming Errors and Solutions
Week 13 Modular Programming:
Introduction to Modular Programming
Header Files and Implementation Files
Creating and Using Libraries
Static and Shared Libraries
Using makefiles for Project Build Automation
Week 14 Project Work and Revision:
Project Discussion and Planning
Working on a Mini Project: Choose a Simple
Application
Project to Implement
Presentations and Code Review
Revision of Key Concepts

Week 1 to 9:
Suggested List of Experiments (The teacher may discuss one or two in the class, and give5-6 problems as takeaway exercises inclu

1 Conversion of numbers from decimal to binary or hexadecimal number systems and vice versa.
2 Design a flowchart for a program that takes two numbers as input from the user and then performs the following operati
Add the two numbers.
Subtract the second number from the first number.
Multiply the two numbers.
Divide the first number by the second number (ensure to handle division by zero).

The flowchart should include decision points to handle division by zero and should clearly illustrate the flow of the progr

3 Design a flowchart for a program that calculates the total cost of a customer's shopping cart items, including tax and an
Prompt the user to input the prices and quantities of each item they wish to purchase.
Calculate the subtotal by multiplying the price of each item by its quantity and summing up all the totals.
Apply any applicable discounts based on the total purchase amount. For example, if the total purchase amount is above
Calculate the tax on the subtotal based on a predetermined tax rate.
Add the tax to the subtotal to obtain the total cost.
Display the subtotal, any discounts applied, the tax amount, and the final total cost to the user.

You can break down the program into separate modules or functions, each responsible for a specific calculation (e.g., s

4 Identify and correct the syntactical errors in a given program (example given below) to make it compile and run correctly

#include <stdio.h>

int main() {

int num1, num2

printf("Enter two numbers: ");

scanf("%d %d", &num1 &num2);

sum = num1 + num2;

printf("The sum is: %d", sum);

return 0;

5 Identify and correct the semantic errors in a given program (example given below) to make it compile and run correctly.

#include <stdio.h>

int main() {

int num1, num2, num3, sum;

float average;
printf("Enter three numbers: ");

scanf("%d %d %d", &num1, &num2, &num3);

sum = num1 + num2 - num3;

average = sum / 2;

printf("The average is: %.2f", average);

return 0;

6 Write a C program that takes an integer as input from the user and prints whether the number is positive, negative, or z
7 Write a C program to implement a simple guessing game. The program should generate a random number between 1 a
8 Write a C program to print the first 10 natural numbers (1 to 10) in reverse order, one number per line.
9 The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually start

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

Write a C program to generate the first 20 terms of the Fibonacci sequence and print them.

10 Write a C program that calculates the factorial of a given number using a separate function for the factorial calculation.
11 Write a C program to calculate the average of a set of numbers. The program should prompt the user to enter the numb
12 Write a C program that simulates a simple banking system. The program should include the following functionalities:
Deposit: Allow the user to deposit a certain amount into their account.
Withdraw: Allow the user to withdraw a certain amount from their account.
Check balance: Display the current balance in the account.

Use static variables to keep track of the total balance across all transactions. Ensure that the total balance is shared am

13 Write a C program that simulates a simple online shopping system. The program should include the following functiona
Add item to cart: Allow the user to add items to their shopping cart.
Remove item from cart: Allow the user to remove items from their shopping cart.
View cart: Display the items currently in the user's shopping cart.

Ensure that each user has their own shopping cart, and use local variables to represent the items in the cart.

14 Write a C program that simulates a simple text editor. The program should allow the user to perform the following opera
Append: Append a string to the end of the current text.
Insert: Insert a string at a specific position in the current text.
Delete: Delete a substring from the current text.
Replace: Replace a substring in the current text with another string.
Print: Print the current text.
15 Write a C program that calculates the value of a mathematical expression involving trigonometric functions and logarith

Sample mathematical expression to evaluate:

sin(x)+cos(y)/log(z)

16 Write a C program that calculates the factorial of a non-negative integer using recursion. The factorial of a non-negative

n! = n*(n-1)*(n-2)*..*3*2*1

Write a C program that implements a recursive function to generate all possible combinations of a given set of characte

For example, given the input string "ABC", the program should generate the following combinations:

ABC
ACB
BAC
BCA
CAB
CBA
17 Write a C program that defines macros for mathematical operations (e.g., addition, subtraction, multiplication, division) a
18 Write a C program that defines a function to swap the values of two integers using pointers. The program should promp
19 Write a C program that takes two nxn matrix as input from the user, calculates the product of the matrices and prints it.
20 Write a C program that takes an array of integers as input, calculates the sum and average of the elements using pointe
21 Write a C program that defines a function to count the number of vowels in a string using character pointers. The progra
22 Write a C program that defines a structure called Student to store the details of a student including name, roll number, a
23 Write a C program that defines a structure called Book to store the details of books including title, author, and price. The
24 Write a C program that defines a structure called Employee to store the details of an employee including name, ID, and
25 Write a C program that defines a typedef for a structure called Point to represent a point in 2D space. The structure sho
26 Write a C program that defines a union called Data to represent a data structure that can store either an integer or a flo
27 Given a C program, comprehend the code by doing the following.
Understand and explain what the code does.
Perform code analysis in the following manner.
Identify the purpose of the code.
Describe the input required from the user.
Explain how the code produces output.
Discuss the role of variables n, i, and j.
Describe the control flow of the nested loops.
Explain the output produced by the code for different inputs.

Sample Program 1:

#include <stdio.h>

int main() {
int n, i, j;

printf("Enter the number of rows: ");

scanf("%d", &n);

for (i = 1; i <= n; i++) {

for (j = 1; j <= i; j++) {

printf("%d ", j);

printf("\n");

return 0;

28 Perform code comprehension as above for sample program 2.

#include <stdio.h>

#define MAX_SIZE 100

int main() {

int arr[MAX_SIZE], n, i, j, temp;

printf("Enter the number of elements: ");

scanf("%d", &n);

printf("Enter %d elements:\n", n);

for (i = 0; i < n; i++) {

scanf("%d", &arr[i]);

}
for (i = 0; i < n-1; i++) {

for (j = 0; j < n-i-1; j++) {

if (arr[j] > arr[j+1]) {

temp = arr[j];

arr[j] = arr[j+1];

arr[j+1] = temp;

printf("Sorted array in ascending order:\n");

for (i = 0; i < n; i++) {

printf("%d ", arr[i]);

printf("\n");

return 0;

29 Comprehend sample program 3 as above.

#include <stdio.h>

int main() {

int n, i, j;

printf("Enter the number of elements: ");

scanf("%d", &n);
int arr[n];

printf("Enter %d elements:\n", n);

for (i = 0; i < n; i++) {

scanf("%d", &arr[i]);

for (i = 0; i < n-1; i++) {

for (j = 0; j < n-i-1; j++) {

if (arr[j] > arr[j+1]) {

int temp = arr[j];

arr[j] = arr[j+1];

arr[j+1] = temp;

printf("Sorted array in ascending order:\n");

for (i = 0; i < n; i++) {

printf("%d ", arr[i]);

printf("\n");

return 0;

}
GITAM School of Technology
Department of Computer Science and Enginnering
Week - wise plan for Coding Classes
Write a C program to implemnet the various operations on a single linked list, double
linked list and circular linked list.

Write a C program to implement the stack and queue operations using arrays and linked
lists.

wo in the class, and give5-6 problems as takeaway exercises including some in the Practice Exercises column above. In the next class, start by

r hexadecimal number systems and vice versa.


numbers as input from the user and then performs the following operations:
nsure to handle division by zero).

handle division by zero and should clearly illustrate the flow of the program from input to output.

the total cost of a customer's shopping cart items, including tax and any applicable discounts. The program should have the following features:
s of each item they wish to purchase.
each item by its quantity and summing up all the totals.
al purchase amount. For example, if the total purchase amount is above a certain threshold, apply a percentage discount.
determined tax rate.

ax amount, and the final total cost to the user.

modules or functions, each responsible for a specific calculation (e.g., subtotal calculation, discount calculation, tax calculation), and then integrate them int

en program (example given below) to make it compile and run correctly.

n program (example given below) to make it compile and run correctly.


from the user and prints whether the number is positive, negative, or zero. Additionally, if the number is positive, check if it's even or odd and print that info
ng game. The program should generate a random number between 1 and 100 (inclusive) and prompt the user to guess the number. After each guess, the
mbers (1 to 10) in reverse order, one number per line.
where each number is the sum of the two preceding ones, usually starting with 0 and 1:

of the Fibonacci sequence and print them.

a given number using a separate function for the factorial calculation. The program should prompt the user to enter a non-negative integer, calculate its fa
set of numbers. The program should prompt the user to enter the number of elements in the set, then prompt the user to enter each element. Finally, the pr
ng system. The program should include the following functionalities:
unt into their account.
mount from their account.

ance across all transactions. Ensure that the total balance is shared among all instances of the banking system.

e shopping system. The program should include the following functionalities:


heir shopping cart.
e items from their shopping cart.
's shopping cart.

art, and use local variables to represent the items in the cart.

ditor. The program should allow the user to perform the following operations on a text string:

with another string.


mathematical expression involving trigonometric functions and logarithms. The program should prompt the user to input the values of variables and evalua

a non-negative integer using recursion. The factorial of a non-negative integer n, denoted as n!, is the product of all positive integers less than or equal to

unction to generate all possible combinations of a given set of characters. The program should take a string of characters as input and print all possible com

rogram should generate the following combinations:

ematical operations (e.g., addition, subtraction, multiplication, division) and uses them to perform calculations. The program should use macros to define th
p the values of two integers using pointers. The program should prompt the user to input two integers, call the swap function to swap their values, and then
nput from the user, calculates the product of the matrices and prints it.
s as input, calculates the sum and average of the elements using pointers, and then prints the sum and average.
nt the number of vowels in a string using character pointers. The program should prompt the user to input a string, call the function to count the vowels, and
d Student to store the details of a student including name, roll number, and marks in three subjects (Physics, Chemistry, and Mathematics). The program sh
d Book to store the details of books including title, author, and price. The program should then create an array of Book structures to store the details of three
d Employee to store the details of an employee including name, ID, and salary. The program should then create a pointer to an Employee structure and allo
ructure called Point to represent a point in 2D space. The structure should have two members: x and y, representing the coordinates of the point. Then, the
ata to represent a data structure that can store either an integer or a floating-point number. Additionally, define a structure called BitField to represent a data
ing the following.
ple program 2.
ogy
d Enginnering
Classes Practice Exercises (from various platforms)
LeetCode: Given an array of integers nums and an integer target, return indices of the
two numbers such that they add up to target.

HackerRank: Diagonal Difference: Calculate the absolute difference between the sums
of the diagonals in a square matrix.

CodeChef: Life, the Universe, and Everything: Write a program that reads numbers
from input and stops processing input after reading the number 42.

Codeforces: Watermelon: Determine if a watermelon can be split into two parts, each
of which weighs an even number of kilos.
LeetCode: Given a string with characters '(', ')', '{', '}', '[', and ']', determine if it is valid.

HackerRank: Write a program to round grades according to specified rules.

LeetCode: Fizz Buzz: Write a program that outputs numbers from 1 to n. For multiples
of three, output
LeetCode: "Fizz";
Factorial for multiples
Trailing of five,
Zeroes: Given anoutput
integer"Buzz"; and
n, return fornumber
the multiples of both
of trailing
zeroes in n!.

HackerRank: Day of the Programmer: Given a year, find the day of the 256th day of
that year.

CodeChef: Reverse The Number: Write a function to reverse the digits of a number.

Codeforces: Beautiful Matrix: Find the minimum number of moves to bring the
number
LeetCode:1 to theSum:
Two center of aan
Given 5x5 matrix.
array of integers nums and an integer target, return the
indices of the two numbers such that they add up to target.

HackerRank: Arrays - DS: Reverse an array of integers.

CodeChef: Small Factorial: Calculate the factorial of a given number.

Codeforces: Beautiful Matrix: Find the minimum number of moves to bring the
number 1 to the center of a 5x5 matrix.
LeetCode: Swap Nodes in Pairs: Given a linked list, swap every two adjacent nodes and
return its head.

HackerRank: Dynamic Array: Implement a dynamic array that performs a series of


queries.

CodeChef: Farmer Feb: Given an array, find the sum of all elements at even positions.

Codeforces: Permutation: Given a permutation of the first n natural numbers, output


the position
LeetCode: of each
Design number.
Linked List: Design your implementation of a linked list. You can
choose to use a singly or doubly linked list.

HackerRank: Structs: Write a program to model and process data using structures.

CodeChef: Student Details: Create a structure to store student details and write
functions to manipulate the data.

Codeforces: Little Elephant and Bits: Manipulate bits within a number to achieve a
desired result.
LeetCode: Read N Characters Given Read4: Given a file and an integer n, read n
characters using a given read4 function.

HackerRank: File Processing: Implement a function to read from a file and process its
content.

CodeChef: File Reading and Writing: Read input from a file, process it, and write the
output to another file.

Codeforces:
LeetCode: Add FileTwo
Operations:
Numbers:Implement basic file of
Solve the problem operations in anumbers
adding two competitive
represented as
linked lists.

HackerRank: Conditional Compilation: Use preprocessor directives to solve problems


with different constraints.

CodeChef: Macro Substitution: Use macros to optimize code for specific problems.

LeetCode: Remove Nth Node From End of List: Given a linked list, remove the nth node
from the end of the list and return its head.

HackerRank: Insert a Node at a Specific Position in a Linked List: Insert a node at a


LeetCode: Valid Parentheses: Given a string containing just the characters '(', ')', '{', '}',
'[', and ']', determine if the input string is valid.
LeetCode: Two Sum: Given an array of integers, return indices of the two numbers such
that they add up to a specific target.

HackerRank: Debugging Challenge: Solve a problem that contains intentional bugs. Use
debugging techniques to identify and fix the bugs.

CodeChef: Error Handling: Write a program that handles errors such as divide by zero or
accessing out-of-bound indices.
LeetCode: Merge Two Sorted Lists: Merge two sorted linked lists and return it as a new
sorted list.

HackerRank: Modular Programming in C: Implement a program that uses modular


programming techniques with separate header and implementation files.

CodeChef: Library Implementation: Write a program that uses a custom library to


perform mathematical operations such as factorial calculation or prime number
checking.

Exercises column above. In the next class, start by discussing any doubts in the previous set.:)
rogram should have the following features:

percentage discount.

calculation, tax calculation), and then integrate them into the main program flowchart.
er is positive, check if it's even or odd and print that information as well.
pt the user to guess the number. After each guess, the program should provide feedback to the user, indicating whether the guess is too high, too low, or co

he user to enter a non-negative integer, calculate its factorial using the factorial function, and then print the result.
n prompt the user to enter each element. Finally, the program should calculate and print the average of the entered numbers using separate functions for in
mpt the user to input the values of variables and evaluate the expression. Ensure to handle error cases such as division by zero or undefined values.

he product of all positive integers less than or equal to n. The factorial of n is defined as:

a string of characters as input and print all possible combinations of those characters.

culations. The program should use macros to define the operations and then demonstrate their usage in various mathematical expressions.
s, call the swap function to swap their values, and then print the swapped values.

input a string, call the function to count the vowels, and then print the count.
Physics, Chemistry, and Mathematics). The program should prompt the user to input the details of three students, store them in an array of Student structur
an array of Book structures to store the details of three books. After storing the details, the program should print the details of all books.
hen create a pointer to an Employee structure and allocate memory for it dynamically using malloc(). After allocating memory, prompt the user to input the
d y, representing the coordinates of the point. Then, the program should create a variable of type Point and initialize it with some values. Finally, it should pr
lly, define a structure called BitField to represent a data structure that stores a set of bit-fields including a flag, an integer value, and a floating-point value. T
e guess is too high, too low, or correct. The user should continue guessing until they correctly identify the random number. Additionally, limit the number of g

rs using separate functions for input, calculation, and output. Additionally, use an external variable to keep track of the sum of the numbers.
zero or undefined values.

ical expressions.

m in an array of Student structures, and then print the details of all students.
s of all books.
ory, prompt the user to input the details of an employee using the pointer, and then print the details of the employee.
some values. Finally, it should print the coordinates of the point.
alue, and a floating-point value. Then, the program should create variables of type Data and BitField, initialize them with some values, and print their conten
m number. Additionally, limit the number of guesses to 10, and if the user exceeds this limit without guessing the correct number, display a message indica

k of the sum of the numbers.


em with some values, and print their contents.
e correct number, display a message indicating that they have lost the game.

You might also like