π§ͺ Note: This README-style document is designed to help candidates prepare and pass the technical entrance tests of YouCode.
This document contains 10 categorized exercises for each major concept in beginner-level C programming, followed by 10 mixed exercises combining all those topics, and 10 advanced exercises for the most challenging problems.
-
Declare an integer variable and print its value. Input: None Output:
The value of a is 10 -
Store your age in a variable and print it. Input: None Output:
I am 22 years old. -
Swap the values of two variables. Input:
a = 5, b = 10Output:a = 10, b = 5 -
Calculate the area of a rectangle using width and height variables. Input:
width = 4, height = 6Output:Area = 24 -
Declare a
charvariable and print it. Input:letter = 'A'Output:Character is A -
Create a float variable and assign a decimal value. Input:
price = 10.5Output:Price is 10.50 -
Assign values to three variables and print their sum. Input:
a = 2, b = 3, c = 5Output:Sum = 10 -
Modify a variable using another variable's value. Input:
a = 4, b = a * 2Output:b = 8 -
Declare a constant using
#defineand print it. Input:#define PI 3.14Output:PI = 3.14 -
Create variables of all 4 main types and print them. Input:
int=1, float=1.5, char='C', double=3.14159Output:int: 1, float: 1.5, char: C, double: 3.141590
-
Print the size of each data type using
sizeof(). Output:int: 4 bytes, float: 4 bytes, double: 8 bytes... -
Declare and assign values to different types. Input:
int=5, float=1.1, char='z'...Output:Values printed -
Convert an
intto afloatand print. Input:int=5Output:float=5.000000 -
Use a
charvariable to store a symbol and print it. Input:char='$'Output:Symbol: $ -
Use a
floatvariable and print it with 2 decimal places. Input:float=3.1459Output:3.15 -
Type casting from
floattoint. Input:float=5.9Output:int=5 -
Overflow demo with
char. Input:char=300Output: unexpected value (e.g., -56 depending on system) -
Print ASCII value of a character. Input:
char='A'Output:65 -
Add an
intand afloat, store indouble. Input:int=3, float=2.5Output:Result=5.5 -
Display limits using
limits.h. Output:INT_MAX = 2147483647...
-
Check if a number is positive or negative. Input:
n = -3Output:Negative -
Check even or odd. Input:
n = 4Output:Even -
Compare two numbers. Input:
a = 5, b = 2Output:a is greater -
Maximum of 3 numbers. Input:
3, 9, 7Output:Max = 9 -
Vowel or consonant. Input:
ch = 'e'Output:Vowel -
Divisible by 5 and 3. Input:
n = 15Output:Yes -
Age group. Input:
age = 16Output:Teenager -
Leap year. Input:
2024Output:Leap year -
Score to grade. Input:
score = 78Output:Grade = B -
Login check. Input:
username: admin, password: 1234Output:Access granted
-
Add/subtract/multiply/divide two numbers. Input:
a=5, b=2Output:Sum=7, Diff=3, Mul=10, Div=2 -
Modulo operation. Input:
7 % 3Output:1 -
Logical AND. Input:
n = 7Output:Yes (between 5 and 10) -
Logical OR. Input:
n = 105Output:True -
NOT example. Input:
flag = 0Output:flag is false -
Increment/decrement. Input:
n = 5Output:++n = 6, --n = 4 -
Compound assignment. Input:
x = 10, x += 5Output:x = 15 -
Relational operators. Input:
a = 3, b = 7Output:a < b, a != b, etc. -
Basic calculator. Input:
a = 3, b = 2, op = +Output:5 -
Divisible by both 3 and 7. Input:
n = 21Output:Yes
-
Weekday name from number. Input:
3Output:Wednesday -
Calculator using switch. Input:
a=4, b=2, op='*'Output:8 -
Grade to message. Input:
grade = 'A'Output:Excellent -
Month to season. Input:
month = 12Output:Winter -
Vowel/consonant with switch. Input:
ch='i'Output:Vowel -
Operation menu. Input:
2Output:Subtraction selected -
Weekday/weekend. Input:
7Output:Weekend -
Loop + switch menu. Input:
menu 1, 2, 3...Output:until user exits -
Use of default case. Input:
invalid = 10Output:Invalid choice -
Nested switch. Input:
Device: 1, Option: 2Output:Submenu Option 2
-
Print 1 to 10. Output:
1 2 3 4 5 6 7 8 9 10 -
Even numbers 1-100. Output:
2 4 6 ... 100 -
Sum first 50 numbers. Output:
1275 -
Factorial. Input:
5Output:120 -
Multiplication table. Input:
3Output:3 x 1 = 3 ... 3 x 10 = 30 -
Reverse digits. Input:
123Output:321 -
Count digits. Input:
4567Output:4 digits -
Fibonacci series. Input:
n = 6Output:0 1 1 2 3 5 -
do...while password check. Input:
wrong, wrong, correctOutput:Access granted -
Prime number check. Input:
7Output:Prime
-
Palindrome number. Input:
121Output:Palindrome -
Swap then calculate. Input:
a=5, b=3, op='+'Output:a=3, b=5, Sum=8 -
Print vowels in string. Input:
"hello"Output:e o -
Even numbers divisible by 3. Input:
range 1β30Output:6 12 18 24 30 -
Menu with loop. Input:
1 2 3 0Output:Add, Subtract, Multiply, Exit -
Age category. Input:
age = 45Output:Adult -
Looping calculator. Input:
a=2, b=3, op='*', repeat=yesOutput:6 -
Reverse string and check palindrome. Input:
"madam"Output:Palindrome -
Largest digit in number. Input:
5489Output:9 -
Login with retry limit. Input:
3 wrong attemptsOutput:Access denied after 3 tries
-
Simple Number Guessing Game User guesses a number between 1-10. Input:
Secret: 7, Guesses: 5, 8, 7Output:Too low! Too high! Correct in 3 attempts! -
Temperature Converter Convert between Celsius and Fahrenheit. Input:
25 C to FOutput:25Β°C = 77Β°F -
Simple Interest Calculator Calculate simple interest for given principal, rate, and time. Input:
Principal: 1000, Rate: 5%, Time: 2 yearsOutput:Simple Interest = $100 -
Digital Clock Format Convert 24-hour time to 12-hour format. Input:
15:30Output:3:30 PM -
Grade Average Calculator Calculate average of 5 grades and show letter grade. Input:
85, 92, 78, 88, 95Output:Average: 87.6, Grade: B+ -
Password Strength Checker Check if password meets basic criteria. Input:
password123Output:Weak: Missing uppercase and special character -
Basic Shape Calculator Calculate area and perimeter of rectangle, circle, triangle. Input:
Shape: circle, radius: 5Output:Area: 78.54, Circumference: 31.42 -
Number to Words (Single Digit) Convert single digit numbers to words. Input:
7Output:Seven -
Simple Payroll Calculator Calculate gross pay with overtime. Input:
Hours: 45, Rate: $15/hourOutput:Regular: $600, Overtime: $112.50, Total: $712.50 -
Basic Unit Converter Convert between common units (meters/feet, kg/pounds). Input:
100 meters to feetOutput:100 meters = 328.08 feet
-
Advanced Pattern Generator Generate various number and star patterns. Input:
Pattern: pyramid, Height: 5Output:* *** ***** ******* ********* -
Roman Numeral Converter Convert numbers to Roman numerals and vice versa. Input:
2024Output:MMXXIV -
Quadratic Equation Solver Solve axΒ² + bx + c = 0 and handle all cases. Input:
a=1, b=-5, c=6Output:x1 = 3, x2 = 2 -
Digital Root Calculator Find digital root by repeatedly summing digits. Input:
9875Output:9+8+7+5=29 β 2+9=11 β 1+1=2, Digital Root: 2 -
Binary Calculator Perform arithmetic operations on binary numbers. Input:
1010 + 1100Output:10110 (10 + 12 = 22) -
Anagram Checker Check if two words are anagrams. Input:
"listen", "silent"Output:Anagram: Yes -
Lottery Number Generator Generate unique random lottery numbers. Input:
6 numbers from 1-49Output:Lucky numbers: 7, 14, 23, 31, 42, 48 -
Grade Book Manager Store and calculate statistics for multiple students. Input:
5 students, 3 subjects eachOutput:Class average: 78.5, Highest: 95, Lowest: 62 -
Palindrome Sentence Checker Check if sentence is palindrome (ignore spaces/punctuation). Input:
"A man, a plan, a canal: Panama"Output:Palindrome: Yes -
Mortgage Calculator Calculate monthly payment and total interest. Input:
Loan: $200,000, Rate: 3.5%, Term: 30 yearsOutput:Monthly: $898.09, Total Interest: $123,312.00
-
Complete Multiplication Table Generator Create a program that generates multiplication tables for any range.
Input:
start=3, end=5, max=12Output:
Table for 3: 3 x 1 = 3 3 x 2 = 6 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 3 x 8 = 24 3 x 9 = 27 3 x 10 = 30 3 x 11 = 33 3 x 12 = 36 Table for 4: 4 x 1 = 4 4 x 2 = 8 4 x 3 = 12 4 x 4 = 16 ... -
Number Pattern Diamond Create a diamond pattern with numbers.
Input:
n = 5Output:
1 123 12345 1234567 123456789 1234567 12345 123 1 -
Prime Number Sieve Generate all prime numbers up to N using optimized algorithm.
Input:
n = 30Output:
2 3 5 7 11 13 17 19 23 29 -
Advanced Calculator with Memory Calculator that remembers previous results and supports complex operations.
Input:
5 + 3 = 8, MEM, 4 * MEM = 32, CLEAROutput:
Result: 32, Memory cleared -
Number Base Converter Convert numbers between different bases (2, 8, 10, 16).
Input:
255 from base 10 to base 2Output:
11111111 -
Perfect Number Generator Find all perfect numbers up to N (number equals sum of its proper divisors).
Input:
n = 100Output:
6 28 -
Matrix Operations Add, subtract, and multiply 2D matrices.
Input:
Matrix A: [[1,2],[3,4]] Matrix B: [[5,6],[7,8]] Operation: multiplyOutput:
[[19,22],[43,50]] -
Text Statistics Analyzer Analyze text for words, characters, vowels, consonants, and frequency.
Input:
"Hello World Programming"Output:
Characters: 23, Words: 3, Vowels: 6, Consonants: 11 Most frequent: 'r' (3 times) -
Number Guessing Game with AI Advanced guessing game where computer learns from player patterns.
Input:
Secret: 42, Guesses: 50, 25, 37, 44, 42Output:
Found in 5 attempts! Pattern detected: binary search -
Financial Calculator Calculate compound interest, loan payments, and investment growth.
Input:
Principal: $1000, Rate: 5%, Time: 3 years, Compound: monthlyOutput:
Simple Interest: $150.00 Compound Interest: $161.47 Monthly Payment: $30.42 Total Amount: $1161.47
- Beginner (Exercises 1-6): Basic syntax, simple logic
- Mixed Practice (Exercise 7): Combining multiple concepts
- Beginner Challenges (Exercise 8): Simple real-world applications
- Medium Challenges (Exercise 9): More complex algorithms and logic
- Advanced Challenges (Exercise 10): Complex algorithms, optimization, advanced applications
- Practice debugging with different inputs
- Focus on edge cases and error handling
- Optimize your solutions for better performance
- Use proper variable naming and code organization
- Test thoroughly with various input combinations