c/c++ Programming questions || Practice Problems for Beginners || C Programs List

  • Conditional Statements:

  • Write a program which takes two integers from the user and tell which number is greater, first or second.
  • Write a program which takes an integer from the user and tells whether it is even or odd.
  • Write a program which takes two integers from the user, subtract them if the result is positive then simply display result if the result is negative then take the mode of result and display result.
  • Write a program which takes two integers from the user and tell, the given integers are equal or not.
  • Write a program which takes an integer from the user and tell, the given integer is positive or negative.
  • Write a program which takes two integers from the user, subtract them if the result is negative then display the product of given integers otherwise simply display "Condition is not true".
  • Write a program which takes two integers from the user, if the second number is not equal to zero then divide the first integer with second and display otherwise display "We can't divide any integer with zero".
  • Write a program which takes three integers from the user, add first and second if the result is greater than third display "Sum is Greater than third integer" otherwise display "Sum is Greater than the third integer".
  • Write a program which takes two integers from the user, subtract them if the result is greater than 10, divide them and display otherwise take product and display.
  • Write a program which takes three integers from the user, calculate the average and tell whether the average is positive or negative.
  • Write a program which takes two integers from the user and tell whether the product of given numbers is positive or not.
  • Write a program which takes two integers from the user, if the second integer is greater or equal to 1 and less or equal to 10 then perform addition, multiplication, subtraction, and division and display all results otherwise display "Second integer is not in range".
  • Write a program which takes two integers from the user, if one of them is zero then perform addition otherwise display "Both is not zero".
  • Write a program which takes obtained marks of two subjects of a student if marks of both subjects are greater or equal to 40 then display "Student is Pass" otherwise display "Student is Fail".
  • Write a program which takes two integers from the user, if the second number is greater than zero divide them, if the second number is less than zero multiply them and if the second number is zero add them.
  • Write a program which takes three integers from the user, and finds the greater number.
  • Write a program that takes the temperature in Celcius and converts it into Fahrenheit and Kelvin.
  • Write a program that takes 2 number and a choice from the user. If the choice is 1 then print sum, if the choice is 2 print product, if the choice is 3 print subtraction, if the choice is 4 print division and if the choice is 5 print modulus of given two numbers.

  • Loops:

  • Write a program which asks the user to give input of an integer and save that number in variable range and print all integers from 0 to that range.
  • Write a program which takes an integer as range and print the sum of all numbers from zero to that range. 
  • Write a program which takes an integer as range and print product of all numbers from zero to that range. 
  • Write a program which takes an integer as range and print all even numbers from zero to that range.
  • Write a program which takes an integer as range and print all odd numbers from zero to that range.
  • Write a program which takes an integer as range and print the sum of all even numbers and sum of odd numbers from zero to that range.
  • Write a program which takes an integer from the user as range and print the total number of even and odd numbers in that range.
  • Write a program which takes an integer from the user and print their table.
  • Write a program which takes an integer and print their factorial.
  • Write a program which takes an integer as the base and another integer as power and calculate them.
  • Write a program to find a number is prime or not.
  • Write a program which takes an integer from user and print all prime numbers from zero to that number.
  • Write a program which takes two integers from the user first as lower_bound and second as upper_bound and print all prime numbers in that range.
  • Write a program which takes two numbers from the user and prints their GCD (Greater Common Divisor).
  • Write a program which takes two numbers from the user and prints their LCD (Least Common Divisor).
  • Write a program which takes an integer from the user and print Fibonacci series from 0 to that integer. 
  • Write a program that takes an integer of base 10 from user to convert it in base 2 (binary number).

  • Arrays:

  • Write a program that takes 5 numbers from the user in an array and prints the array in reverse order.
  • Write a program that takes 5 numbers in the 1st array and 5 numbers in the 2nd array and merges them in the 3rd array of size 10 and prints the 3rd array.
  • Write a program that takes 10 numbers in an array and sorts them in ascending order.
  • Write a program that takes 10 numbers in an array and sorts them in descending order.
  • Write a program that takes 5 number in an array and prints them and then ask the user to enter a number to delete from the array. If the number is present in the array then the number should be deleted otherwise print the message "Not present in array".
  • Write a program to find the largest number in an array without sorting.
  • Write a program to find the smallest number in an array without sorting.
  • Write a program to find the second largest number in an array without sorting.
  • Write a program to find the second smallest number in an array without sorting.
  • Write a program that takes 5 numbers in an array and print sum and product of all numbers of the array.

  • String:

  • Write a program that takes a string from the user and print it in reverse order.
  • Write a program that takes a string and print the total number of characters in that string.
  • Write a program that takes a string and a character from the user and count the occurrences of the character in the string and print it. For example, user give string "itachay" and give character to count in "itachay" is "a" So as "a" present two times in string "itachay" the program will print 2 and if character was "y" then program has to print 1 as "y" present 1 time in given string.
  • Write a program that takes a string and convert all upper case characters to lower case and all lower case characters to upper case.
  • Write a program that takes two strings and merge them.

Comments

Popular posts from this blog

Change your Application background in Scene Builder || JavaFX FXML Tutorial

Implementation of Graph in C || Directed and Undirected Graph