#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🧩 FREE · 20 PROBLEMS

C Programming Practice Problems: 20 Exercises with Sample Tests

From sum of digits to matrix multiplication: write your code, run it, and check your output against the expected results.

  • ✅ Sample tests for each
  • 💡 Hints and solutions
  • 📈 Progress saved

How to use the C Programming Practice Problems

  1. 1. Pick a problemFilter by level and choose a problem. Its task and sample tests appear below.
  2. 2. Write and run it locallyWrite your C solution here (it's saved in this browser), then run it with gcc on each sample input.
  3. 3. Check your outputPaste what your program printed for each test and press Check. Solved problems get a tick.

What's in the set

The 20 problems cover what C exams and fresher interviews ask most: digit problems (sum of digits, reversing a number, Armstrong numbers), primes, Fibonacci and factorial with the right integer types, arrays (largest and smallest, reversing in place, second largest, binary search, bubble sort), strings (vowels, palindromes, length without strlen, character frequency), pointers (swapping through int *), and 2-D arrays (transpose and matrix multiplication).

Every reference solution was compiled with gcc using -Wall -Wextra -Werror and run against all of its sample tests before publishing.

Worked example: second largest element

For the input 5 and 10 20 4 45 99, the expected output is 45. The trap is duplicates: for 3 and 5 9 9 the answer is 5, not 9, and if every value is the same the program must print -1. The hint shows the one-pass method: keep first and second; when a value beats first, the old first becomes second.

If your program prints 45 with a trailing space, the checker still accepts it, because spaces at the ends of lines are ignored. A missing line or a different number is reported with the position of the first difference.

Why this page doesn't run C

Compiling C in the browser would need a large WebAssembly compiler download, and sending your code to a server would mean uploading it. Instead, you run it with gcc on your own computer or any compiler you already use, and this page checks the output. It's the same skill online judges test: exact output for given input.

Frequently asked questions

Which compiler should I use?

Any C11 compiler: gcc, clang or MinGW on Windows. Compile with warnings on, like gcc -Wall main.c.

How do I feed the sample input?

Type it in when the program waits, or save it to input.txt and run ./main < input.txt.

Is my code uploaded?

No. Your code and outputs stay in your browser.

Is the C practice problems free?

Yes. Everything in the C practice problems works without signing up. The first time you ask for a result, we ask once for your name and WhatsApp number; after that the C practice problems and every other Uncodemy tool open straight away.

More free tools

See all free tools