Project Euler 1: Multiples of 3 and 5

Problem: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. We need to find the sum of all the multiples of 3 or 5 below 1000. View this problem on Project Euler. Algorithm: The … Read more

Switch case programming exercises and solutions in C

switch case is a branching statement used to perform action based on available choices, instead of making decisions based on conditions. Using switch case you can write more clean and optimal code than if else statement.

switch case only works with integer, character and enumeration constants.

In this exercises we will focus on the use of switch case statement. We will learn where to implement switch case statement other than if else statement.

Read more

C program to find maximum between two numbers using switch case

Write a C program to input two numbers from user and find maximum between two numbers using switch case. How to find maximum or minimum between two numbers using switch case. Logic to find maximum between two numbers using switch case in C programming.

Example
Input

Input first number: 12
Input second number: 40

Output

Maximum: 40

Read more

C program to print number of days in a month using switch case

Write a C program to input month number and print total number of days in month using switch...case. C program to find total number of days in a month using switch...case. Logic to print number of days in a month using switch...case in C programming.

Example
Input

Input month number: 3

Output

Total number of days = 31

Read more