Saturday, September 19, 2026

COMPUTATIONAL THINKING AND PROBLEM SOLVING USING C LAB


WEEK1 Exercise 1


 A2610008 - COMPUTATIONAL THINKING AND PROBLEM SOLVING USING C LAB 


Prerequisites: Basic understanding of computer fundamentals and problem-solving concepts 

Course Objectives: The main objective of the course is to  

  •  Apply the principles of C language and computational thinking techniques in problem solving.
  •  Design flowcharts and algorithms, and to develop the ability to trace and debug programs. 
  •  Design and develop C programs using arrays, strings, pointers, recursion, and functions. 
  •  Apply dynamic memory allocation, file operations, and preprocessor commands in program design.      
    

COs

Course Outcome (CO) Statement

Bloom’s Level

CO1

Apply computational thinking to construct algorithms and flowcharts for a given problem and translate them into working C programs.

K3

CO2

Develop C programs using operators, selection statements and loops to implement a specified logic.

K3

CO3

Develop C programs that manipulate arrays, strings, structures and pointers to solve computational problems.

K3

CO4

Construct modular programs using user-defined functions and recursion and perform file input-output operations.

K3

CO5

Analyse a C program by tracing and debugging it and evaluate alternative implementations for correctness and efficiency.

K4


Lab Requirements (tools / software to carry out the experiments):

    · C compiler: GCC (GNU Compiler Collection) — via MinGW-w64 on Windows, or the built-in gcc on Linux/macOS.
· IDE / editor: Code::Blocks, Dev-C++ or Visual Studio Code with the C/C++ extension.
·  Command-line terminal to compile and run programs (gcc, ./a.out) and observe the compile–link–run stages.
·  Debugger: GDB (GNU Debugger), integrated in Code::Blocks / VS Code, for tracing and step-by-step debugging.
·  Operating system: Windows 10/11 or a Linux distribution (e.g., Ubuntu); any 64-bit PC with 4 GB RAM or more.
·  
No-install alternative: OnlineGDB, Programiz or Replit for quick practice and testing in a browser.

 

List of Experiments

Exercise 1: Getting Started with


1. Write, compile and run a C program that prints “Hello, World!” on the screen. Identify the source file, the object file and the executable produced, and record the command used at each stage.

2. Write a C program that declares variables of type int, float, char and double, reads a value for each from the user, and displays each value together with the size of its type using sizeof.

3. Write a C program to read the height and width of a rectangle from the user and compute its perimeter and are.

 Exercise 2: Operators and Expressions


1. Write a C program to compute the distance between two points whose coordinates are entered by the user.

2. Write a C program that reads four integers p, q, r, s and, using relational and logical operators, prints 'Correct values' if q > r, s > p and (r + s) > (p + q); otherwise 'Wrong values'.

3. Write a C program to compute simple and compound interest for values entered by the user.

 Exercise 3: Selection and Decision Making


1. Write a C program to read a character and classify it as a vowel, consonant, digit or special symbol.

2. Write a C program to find the largest of three numbers using nested if-else.

3. Write a menu-driven C program to compute the area of various geometrical shapes (circle, rectangle, triangle, square) using switch-case.

 Exercise 4: Loops and Series

1. Write a C program to display the first n even natural numbers and their sum.
2. Write a C program to reverse a given integer and check whether it is a palindrome.
3. Write a C program to display the sum of the harmonic series 1 + 1/2 + 1/3 + ... up to n terms.

 Exercise 5: Nested Loops and Number Patterns


1. Write a C program to print the multiplication table pyramid for numbers 1 to n using nested loops.

2. Write a C program to check whether a given number is prime, then extend it to print all prime numbers and all Armstrong numbers below.

 Exercise 6: One-Dimensional Arrays


1. Write a C program to print all unique elements of an array, and implement linear search to find a given element in the array.

2. Write a C program to separate the odd and even elements of an array into two different arrays, and implement binary search to find a given element in a sorted array.

3. Write a C program to sort the elements of an array in ascending order using selection sort, and compare the efficiency of linear search vs. binary search on the sorted array by counting the number of comparisons each method takes.

 Exercise 7: Matrices


1. Write a C program to perform addition of two square matrices and display the resultant matrices.

2. Write a C program to multiply two square matrices and display the resultant matrices.

3. Write a C program to find the transpose of a given matrix.

 Exercise 8: Strings:

 

Write C programs to perform the following without using string handling functions
·     Find the length of a given string.
·     Copy one string into another.
·     Concatenate two strings.
·     Compare two strings and display whether they are equal, or which one is greater.
·     Reverse a given string (using a separate swap function to exchange characters).
·     Search for a character in a string and display its position (or indicate if not found).
·     Count the number of vowels, consonants, and words
in a given string

 Exercise 9: Pointers Fundamentals


  1. Write a C program to demonstrate the use of the & (address-of) and * (value-at-address) operators.

  2. Write a C program to add two numbers using pointers.

  3. Write a C program to swap two values using call by reference.


     Exercise 10: Pointers and Dynamic Memory

    1. Write a C program to dynamically allocate memory for an array using malloc, find the           largest element and the sum of all elements in it, then repeat using calloc and note the           difference between the two.
    2. 
Write a C program to count the number of vowels in a string using a pointer.

    Exercise 11: User-Defined Functions


1. Write a C program to check whether a number is prime using a user-defined function.

2. Write a C program to compute the GCD and LCM of two numbers using functions.

3. Write a C program to demonstrate a function that returns a pointer.

     Exercise 12: Recursion


1. Write a C program to compute the factorial and the n-th Fibonacci term using recursion.

2.  Write a C program to compute the sum of digits of a number using recursion.

3. Write a C program to convert a decimal number to its binary equivalent using a recursive function.

   Exercise 13: File Handling


1.  Write a C program to append multiple lines at the end of an existing text file.

2.  Write a C program to copy the contents of one file into another file.

3.  Write a C program to count the number of characters, words and lines in a text file.

 

  Web References:

·       NPTEL – Programming in C, IIT Kanpur:
https://onlinecourses.nptel.ac.in/noc21_cs81/preview

·  Virtual Labs – Problem Solving Lab, IIIT Hyderabad: https://ps-iiith.vlabs.ac.in/

·      GeeksforGeeks – C Programming: 

https://www.geeksforgeeks.org/c-programming-language/

 



 A2610003 - COMPUTATIONAL THINKING AND PROBLEM SOLVING USING C 

Prerequisites: Mathematics and logical reasoning at 10+2 level. No prior programming experience is assumed. 

Course Objectives: The main objective of the course is to 

  •  Familiarize students with computers, computational thinking, and the process of algorithmic problem solving. 
  •  Build strong programming fundamentals using the C language, including operators, control structures, and loops. 
  •  Develop the ability to design and implement solutions using arrays, strings, and user- defined data types. 
  •  Impart working knowledge of pointers, recursion, dynamic memory allocation, functions, and file handling for building modular, reusable programs. 

Course Outcomes: At the end of this course, the student will be able to COs 

COs

Course Outcome (CO) Statement

Bloom’s Level

CO1

Apply computational thinking techniques (decomposition, abstraction, pattern recognition) to design algorithms and flowcharts for a given problem.

K3

CO2

Develop C programs using appropriate operators, expressions, selection statements, and loops to implement a given logic.

K3

CO3

Analyze problems involving arrays, strings, structures and unions and construct suitable C solutions.

K4

CO4

Apply pointers, recursion, and dynamic memory allocation to solve computational problems efficiently.

K3

CO5

Construct modular C programs using user-defined functions and perform text/binary file input-output operations.

K3


 UNIT-I: Computational Thinking and Introduction to C 

Computational Thinking: Decomposition, Pattern Recognition, Abstraction, Algorithm Design; representing solutions as algorithms, pseudocode, and flowcharts; Number Systems and Data Representation (integers, reals); Overview of Computer Organization and Program Execution. 

Introduction to C: Background, Structure of a C Program, Identifiers, Keywords, Variables, Constants, Basic Data Types, Input/Output statements; Expressions, Operators, type of operators- arithmetic, relational, logical, bitwise, assignment, conditional, increment, decrement, etc., unary, binary, ternary, Operator Precedence and Associativity, Type Conversion; Scope, Storage Classes, and Type Qualifiers. 

UNIT-II: Selection and Decision-Making: Simple if, Two-Way selection- if-else, nested-if, else-if ladder, and Multi-Way Selection- switch. Repetition: Counter- and Event-Controlled Loops: for, while, do-while, and nested loops; Break and continue, Programming Applications combining Selection and Repetition. Arrays: One-Dimensional and Two-Dimensional Arrays, Multidimensional Arrays, Array-based Problem Solving (searching, sorting, etc.). 

UNIT-III: 

Functions: Designing Structured/Modular Programs, Function Declaration and Definition, Parameter Passing (by value, by reference using pointers), Passing Arrays and Pointers to Functions, Standard Library Functions, Inter-Function Communication. Recursion: Recursive vs. Iterative Solutions, Designing Recursive Algorithms, Recursion with Arrays and Pointers, Efficiency Considerations.  

Strings: String Representation, Standard String-Handling Functions, Arrays of Strings, String-to-Data Conversion. 

UNIT-IV: 

Pointers: Pointer Fundamentals, Pointer-to-Pointer, Pointer Arithmetic, Pointers and Arrays, Array of Pointers, types of pointers, Compatibility and L-value/R-value concepts. Dynamic Memory Allocation: malloc, calloc, realloc, free.  

User-Defined Types: Typedef, Enumerated Types, Structures, Unions, and Nested Structures; Programming Applications using Structures and Arrays of Structures. 

UNIT-V: 

Pre-processor: Directives and Macros. Command Line Arguments. 

File I/O: Streams, Text vs. Binary Files, Standard Library File Functions, formatted and Character I/O, Sequential File Processing. 

TEXT BOOKS:

 1. Behrouz A. Forouzan & Richard F. Gilberg, Computer Science: A Structured Programming Approach Using C, 3rd Edition, Cengage Learning, ISBN-13: 978-0-534-49132-1.
 2. Brian W. Kernighan & Dennis M. Ritchie, The C Programming Language, 2nd Edition, Pearson Education / Prentice Hall India, 1988. 

 REFERENCE BOOKS: 

1. Sumitabha Das, “Computer Fundamentals and Programming”, 18th Edition, McGraw Hill Education, 2018. 
2. Ashok N. Kamthane, Amit Ashok Kamthane, “Programming in C”, 4th Edition, Pearson Education, 2025. ISBN: 978-9332543633.
 3. Pradip Dey, Manas Ghosh, “Computer Fundamentals and Programming in C”, 2nd Edition, Oxford University Press, 2013. ISBN: 978-0198068842. 

E-RESOURCES: 

1. NPTEL – Programming in C, IIT Kanpur: https://onlinecourses.nptel.ac.in/noc21_cs81/preview 
2. Geeks for Geeks – C Programming Language: https://www.geeksforgeeks.org/c-programminglanguage/ 
3. Programiz – Learn C Programming: https://www.programiz.com/c-programming 
4. cplusplus.com – C Standard Library Reference: https://cplusplus.com/reference/clibrary/ 
5. TutorialsPoint – C Programming: https://www.tutorialspoint.com/cprogramming/index.html 
6. W3Schools – C Tutorial: https://www.w3schools.com/c/ 

Wednesday, August 5, 2026

Technical Training

Basic Number Based Problems

 1. Positive or Negative Numbers

 2. Even or Odd Numbers

 3. Sum of First N Natural numbers

 4. Sum of N natural numbers

 5. Sum of numbers in a given range

 6. Greatest of two numbers

 7. Greatest of the Three numbers

 8. Leap year or not

 9. Prime number

 10. Prime number within a given range

 11. Sum of digits of a number

 12. Reverse of a number

 13. Palindrome Number

 14. Armstrong Number

 15. Armstrong Number in a given range

 16. Fibonacci Series upto nth term

 17. Find the Nth Term of the Fibonacci Series

 18. Factorial of a number

 19. Power of a number

 20. Factor of a number

 21. Finding Prime Factors of a number

 22. Strong number

 23. Automorphic number

 24. Harshad number

 25. Abundant number

 26. Friendly pair

Number-Based Problems


1. Spy Number: check if the sum of digits equals the product of digits for a given number. Print all Spy numbers up to N.

2.Magic Number: a number is Magic if recursively summing its digits yields 1. Check if N is a Magic number.

3.Happy Number: repeatedly replace N with the sum of squares of its digits. Detect if N eventually reaches 1.

4.Perfect Number: a number equals the sum of its proper divisors. Find all Perfect numbers up to N.

5.Perfect Square: check if a number is a perfect square without using sqrt().

6.Neon Number: the sum of digits of N-squared equals N itself (e.g. 9: 9²=81, 8+1=9). Find all Neon numbers in [1, 1000].

7.Buzz Number: a number divisible by 7 or ending in 7. Print all Buzz numbers in a given range [L, R].

8.Tribonacci Series: generate first N terms where T(n) = T(n-1)+T(n-2)+T(n-3). Also generate the Padovan and Jacobsthal series.

9 Krishnamurthi / Strong Number: sum of factorials of digits equals the number. Find all Strong numbers up to N.

10 Evil Number: numbers whose binary has an even number of 1-bits. In range [L,R] count how many are Evil vs Odious. Also identify Strobo-strategic numbers in the same range.

11 Pronic Number: product of two consecutive integers. Find all Pronic numbers in [1, N]. 

12 Unique Number: no digit repeats. Print all unique 3-digit numbers (100–999). 

13 Nelson Number (111): check if N is 111 or a multiple pattern. Generalise: find all repunit numbers up to N.

14 Peterson Number: equals the sum of factorials of its digits raised to the power of their 1-based position. Check if N is a Peterson number.

15 Given a range [L, R], find all numbers that are simultaneously a Perfect Square AND a Perfect number.

Monday, March 30, 2026

PYTHON PROGRAMMING UNIT-V : Introduction to Data Science: Functional Programming, JSON and XML in Python, NumPy with Python, Pandas.

 

Sample Experiments:

1. Python program to check whether a JSON string contains complex object or not.
2. Python Program to demonstrate NumPy arrays creation using array () function.
3. Python program to demonstrate use of ndim, shape, size, dtype.
4. Python program to demonstrate basic slicing, integer and Boolean indexing.
5. Python program to find min, max, sum, cumulative sum of array
6. Create a dictionary with at least five keys and each key represent value as a list where this list contains at least ten values and convert this dictionary as a pandas data frame and explore the data through the data frame as follows:
7. Apply head () function to the pandas data frame
8. Perform various data selection operations on Data Frame

9. Select any two columns from the above data frame, and observe the change in one attribute with respect to other attribute with scatter and plot operations in matplotlib 

 Programs Click link

Monday, March 16, 2026

 

               PYTHON PROGRAMMING  UNIT-IV:

Files: Types of Files, Creating and Reading Text Data, File Methods to Read and Write Data, Reading and Writing Binary Files, Pickle Module, Reading and Writing CSV Files, Python os and os.path Modules.

File Programs Click link


Object-Oriented Programming: Classes and Objects, Creating Classes in Python, Creating Objects in Python, Constructor Method, Classes with Multiple Objects, Class Attributes Vs Data Attributes, Encapsulation, Inheritance, Polymorphism.

OOPS Programs Click Link

Sunday, March 1, 2026

 

PYTHON PROGRAMMING UNIT3


Dictionary Data Structure link1 link2

PYTHON TUPLE and  SET link1

Tuple Notes link
Set Notes link

COMPUTATIONAL THINKING AND PROBLEM SOLVING USING C LAB WEEK1  Exercise 1