StudyLover
  • Home
  • Study Zone
  • Profiles
  • Typing Tutor
  • Contact us
  • Sign in
StudyLover Programs LIst
Download
  1. C Programming
Programming for Problem Solving
C Programming
  • Unit 1: Foundations of Problem Solving & C Language Basics
  • Unit 2: Program Control Flow & Logic
  • Unit 3: Modular Programming with Functions, Arrays & Recursion
  • Unit 4: Advanced Data & Memory Management

Unit 1

1.                  Print “Hello, World!”.
Write a minimal C program that prints the line “Hello, World!” to the console. No input is required; compile and run to verify your toolchain.

2.                  Sum and average of three numbers; operator precedence.
Read three numbers, compute their sum and average. Also print the result of one complex expression twice—once as-is and once with parentheses—to show precedence effects.

3.                  Simple Interest and Compound Interest.
Take principal, rate, and time as input and compute SI = (P×R×T)/100 and CI using the standard formula. Display both values with two decimal places.

4.                  Type conversion: integer division vs explicit cast.
Read two integers and show a/b (integer division) versus (float)a/b. Explain the difference in outputs caused by casting.

5.                  Temperature converter (°C ↔ °F).
Read a temperature and convert between Celsius and Fahrenheit using the right formula. Print both values neatly formatted.

6.                  Maximum of two numbers using if.
Read two integers and print the larger one using a simple if/else. Handle the “both equal” case explicitly.

7.                  Even/Odd checker for an integer.
Input an integer and use the modulus operator to test parity. Report “even” or “odd”; include zero in the even case.

8.                  Sign of a number: positive/negative/zero (nested if-else).
Read a number and classify it as positive, negative, or zero using nested conditionals. Print the category only.

9.                  Largest of three numbers (nested if-else).
Read three numbers and determine the largest with nested if blocks. Also mention if two or three numbers tie.

10.            Absolute value without library calls.
Read an integer and, if it is negative, multiply by −1; otherwise leave it unchanged. Print the absolute value.

 

Unit 2

11.            Leap year checker.
Read a year and apply the rules: divisible by 400 → leap, divisible by 100 → not leap, divisible by 4 → leap, else not. Print the correct verdict.

12.            Grade calculator from percentage.
Read a percentage and assign a grade via an if–else ladder (e.g., A, B, C, D, F). Validate that input lies in 0–100.

13.            Menu-driven basic calculator using switch.
Show a menu for +, −, ×, ÷; read two operands and the user’s choice. Perform the operation with a switch and guard against division by zero.

14.            Character classifier using switch.
Read a single character and classify it as vowel, consonant, digit, or other. Use a switch with grouped cases for vowels.

15.            Sum of first N natural numbers using three loops.
Read N and compute the sum using for, then while, then do…while. Print all three results and confirm they match.

16.            Prime number test with early exit.
Read an integer ≥2 and check divisibility up to √n, breaking early on the first factor. Report “prime” or “composite”; handle n < 2 clearly.

17.            Pattern printing (pyramids).
Read row count and print a right-angled and a centered pyramid using nested loops. Ensure spaces and stars align properly.

18.            Count digits in an integer.
Read an integer and count its digits by repeated division by 10. Handle zero (1 digit) and negative numbers correctly.

 

Unit 3

19.            Linear search in a 1-D array (function).
Read N and an array, then a key; search sequentially and return index or −1 from a function. Print whether the key was found.

20.            Count even and odd elements in an array.
Read N and the array, traverse once and increment even/odd counters. Print both counts at the end.

21.            Largest and second largest in one pass.
Read N and update largest and secondLargest as you iterate. Handle duplicates and the case N < 2 gracefully.

22.            Reverse an array in place (two pointers).
Read N and the array, then swap elements from both ends moving inward. Print the reversed array.

23.            Array statistics via functions.
Implement functions for sum, average, min, and max; pass the array to each. Print all metrics in a single summary line.

24.            Matrix addition and subtraction.
Read dimensions and two matrices of the same size. Compute A±B element-wise and print the result matrices.

25.            Matrix multiplication with compatibility check.
Read sizes of A (r1×c1) and B (r2×c2); if c1≠r2, print an error. Otherwise compute A×B using triple loops and display the product.

26.            Transpose and symmetric check.
Read a square matrix, compute its transpose, and compare with the original. Report whether the matrix is symmetric.

27.            String utilities without <string.h>.
Implement your own length, copy, compare, and reverse and call them via a small menu. Work only with character arrays and loops.

28.            Count character categories in a string.
Read a line and count vowels, consonants, digits, spaces, and special characters. Print category-wise totals.

29.            Count words in a sentence.
Read a line and count transitions from “non-word” to “word” characters to handle multiple spaces. Print the total word count.

30.            Palindrome string check (case-insensitive).
Read a string, optionally ignore case and spaces, and compare from both ends. Print whether it is a palindrome.

31.            Call by value vs reference (swap).
Write two swap functions: one by value (no effect on caller) and one using pointers (effect visible). Demonstrate the difference with prints before/after.

32.            Iterate an array via pointer arithmetic.
Use a pointer to traverse the array and find the max and its index. Print the max value and position.

33.            Recursion: factorial and Fibonacci.
Implement recursive versions and compare results to iterative implementations. Emphasize base cases and termination.

34.            Recursion: sum from 1 to N.
Read N and compute 1 + 2 + … + N recursively with a clear base case. Print the sum and caution about large N.

35.            Recursion: reverse a string.
Reverse a string by recursively swapping outer characters moving inward. Print the reversed string.

 

Unit 4

36.            Pointer basics and array sum via pointer traversal.
Declare variables and print their addresses, then dereference to show values. Use a pointer to sum all elements of an array.

37.            malloc: dynamic array and mean.
Read N, allocate an int array with malloc, input elements, and compute the average. Print the mean and free the memory.

38.            realloc: grow/shrink a dynamic array.
Start with a small dynamic array, then add/remove elements by resizing with realloc. Keep data consistent and free at the end.

39.            struct Student {roll, name, marks} with pass/fail.
Read multiple student records into an array of structures. Compute average marks and print pass/fail using if/switch.

40.            File copy and text statistics.
Open a source and destination text file; copy character by character. While copying, count lines, words, and characters and print the summary.

 

Programming for Problem Solving
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website