Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


C Programming Code Examples

C > If Else and Switch Case Code Examples


If the ASCII value of the character entered by the user lies in the range 97 to 122 or from 65 to 90, that number is an alphabet. 'a' is used instead of 97 and 'z' is used instead of 122. 'A'


This C Program takes an arithmetic operator +, -, *, / and two operands from the user and Performs the Calculation on the 2 operands depending upon the operator entered by the













In programming if...else statement executes two different codes depending upon whether the test expression is true or false. Sometime a choice has to be made from more than two

Checking Alphabet, Digit or Special character using ASCII value. A character is alphabet if it in between a-z or A-Z. A character is digit if it is in between 0-9. And A character is special

C Language program Check Alphabets using ASCII code. Every printable & non-printable Symbol is treated as a Character and has an ASCII code. The ASCII code is unique integer


Code Step by Step descriptive logic to check Uppercase and Lowercase alphabets. Input a character from user. Store it in some variable say ch. Character is uppercase alphabet if(ch


Despite of easiness, the above code is messy and less readable. printf("The Triangle is not valid."); statement is unnecessarily repeated for various conditions. You can cut the extra
English Alphabets a, e, i, o, u both Lowercase & Uppercase are known as vowels. Alphabets other than Vowels are known as Consonants. Step by step descriptive logic to check vowels
Program to check Vowel or Consonant using switch-case statement. I already explained in sample to print number of days in months, if switch case contains same action for multiple
Step by step descriptive logic to create menu driven calculator that performs all basic math operations. Input 2 numbers and a Character from user in the given format. Store them in
Finding maximum in general is comparison of two numbers. In C programming we compare 2 quantities using relational operator. We can write expression to find maximum between j1
Finding maximum in general is comparison of two numbers. In C language we compare two quantities using relational operator. We using either > or < operator to compare 2 numbers
Instead of using Nested If Else. Lets combine 2 or more conditions together using Logical Operators. A number j1 among 3 numbers j1, j2 and j3 is said maximum if j1 > j2 and j1 > j3.
Find number of Days in a Month using switch case - best approach. Lets Observe the above program carefully for a moment. In the above program we are performing same action on...
Input week day number from user. Store it in a variable say week. Print Monday if week=1. I have assumed Monday as first day of week. And check condition for all 7 days & print the
The above logic is simple & easy to code. But it's lengthy and not optimal to implement. In the above solution we are performing same task for multiple conditions i.e. print 31 days
The Switch Case statement is used when we have multiple options & we need to perform a different task for each option. Case doesnt always need to have order 1, 2, 3 and so on...

Page 1 Page 2