Skip to content

👉Well curated repo. containing solutions for all the practice questions that I've solved while I was learning C and C++. 💡Check the README for categorized questions. This repo. can be useful for beginner and intermediate-level C or C++ programmers. If you found this repo. useful, don't forget to star the repo and give a follow.

License

Viztruth/C-and-Cpp-Practice-problems-with-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C or C++ Practice problems with solutions for beginners

Golang

Well curated repo. containing all the practice questions that I've solved while I was learning C and C++. These are simple C.S. lab-level questions designed to test your skills. This repo. can be useful for beginner and intermediate-level C or C++ programmers. I have just uploaded the code along with questions topicwise. For the ones that I felt a detailed explanation was necessary, I have given it in my blog. You can check that if you want. For the rest, the code is self-explanatory.
The C or C++ programs are easily inter-convertible by replacing the printf/scanf with cout/cin and vice versa and such, it shouldn't be much difficult to convert.
This repository will be regularly updated to include new problems I've solved or errors that I've resolved.
If you felt the repository was useful, do star the repo, and give a follow. It would mean a lot to me.

If you have any questions, doubts related to the code, don't hesitate to ask them here(blog) or in github discussions.

💡 Note: ✅ Button indicates that I have given a detailed explanation for the program in my blog.

Solved Problems:

⭐ Arrays, Functions and Recursion ⭐
• Setting decimal precision to 'n' decimal places | C
• Determine whether positive or negative number | C
• Determine odd or even | C
• Sum of digits of a number | C
• Sum of digits of a number in given range | C
• Check whether prime or not | C
• Print the prime numbers in a given range | C
• Function to swap 2 nos. without 3rd variable | C++
      Function to swap 2 nos. without 3rd variable | C
• Static array vs dynamic array | C++
• Creation of dynamic array | C++
• Addition of 2 numbers using template function | C++
• Addition of n continuous numbers using template function | C++
• Multiplication tables generator | C++ ✅
      Multiplication tables generator | C ✅
• Factorial of a number using recursion | C++
    Factorial of a number using iteration | C++
• Generating fibonacci sequence using recursion | C++
• Power of a number using recursion | C++
• Converting integers into expanded form | C++ ✅
• Merge 2 arrays | C++
• Insert or Delete element from the array | C
• Program to implement Euclid's Algorithm for computing GCD | C
• nCr Combinations | C++
• Calculating area of a rectangle via different parameter passing techniques | C++
• Reversing an array | C++
• Random number generator | C++ ✅
      Random number generator | C ✅
• Simple stone paper scissor game | C++ ✅
• Integer to roman number converter | C++
• Check whether array is sorted | C++
• Check whether array is in ascending or descending order | C
• Check whether the given array is in arithmetic progression | C++
• Finding the 3 consecutive nos. in A.P. given their sum and product | C++ ✅
• Different ways of passing arrays as parameters to a function| C++ ✅
• Union of arrays - Set operations | C ✅
      Union of arrays - Set operations | C++ ✅
• Intersection of arrays - Set operations | C++ ✅
• Set difference of arrays - Set operations | C++ ✅
• Finding the missing natural numbers using Hashing | C
• Finding the missing natural numbers | C
• Finding the no. of duplicate elements in the array | C
• Finding the no. of duplicate elements in the array using hashing | C
• Deleting duplicate elements from an array | C++
• Creation of Rectangle class | C++ [Classes and objects]
• Student details using classes | C++ [Classes and objects]


⭐ Strings ⭐
ℹ️ Alternate methods of taking string inputs (GfG)
• Displaying your name using strings | C++ ✅
• Count Vowels and consonants in a string | C
• Count no. of words in a string | C
• Passing string as parameter to a function | C
• Captcha text generator (Random text generator) | C
• Check whether the given string is a palindrome | C
• Check whether the strings are anagram or not | C
• Tokenize a string | C
• Program to print the frequency of digits in a string of alphabets and numbers | C


⭐ Matrices ⭐
• Create and display diagonal matrix using 1D array | C
• Create and display diagonal matrix using 2D array | C
• Create and display diagonal matrix using 2D array | C++ [Classes and objects]
• Create and display lower triangular matrix using 2D array | C
• Create and display upper triangular matrix using 2D array | C
• Create and display symmetric matrix via upper triangular matrix using 2D array | C
• Create and display symmetric matrix via lower triangular matrix using 2D array | C
• Program to add two matrices and store the result in third matric | C


⭐ Linked List ⭐
• Program to read array into singly linked list | C
• Display the elements of singly linked list using recursion | C
• Basic Insert, Delete, Display, Length operations on Singly Linked list | C
• Basic Insert, Delete, Display, Length operations on Singly Linked list | C++ [Classes and objects]
• Creation of a linked list to store unique elements from an array | C
• Sum of all the elements of a singly linked list | C
• Max and Min elements of a singly linked list | C
• Searching an element in singly linked list using linear search | C
• Improved linear search method | C
• Insert into sorted linked list | C
• Program to check whether the S.L.L. is sorted or not | C
• Program to remove duplicates from S.L.L. | C
• Program to reverse the S.L.L. using an array | C
• Program to reverse the S.L.L. by reversing the links | C
• Program to concatenate 2 single linked lists | C
• Program to check whether there's a loop in the single linked list | C
• Program to create and display circular linked list | C
• Insertion into circular linked list | C
• Deletion in circular linked list | C

About

👉Well curated repo. containing solutions for all the practice questions that I've solved while I was learning C and C++. 💡Check the README for categorized questions. This repo. can be useful for beginner and intermediate-level C or C++ programmers. If you found this repo. useful, don't forget to star the repo and give a follow.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published