C program to find sum of natural numbers from 1 to n
Example Input Input upper limit: 10 Output Sum of natural numbers 1-10: 55 Program to find sum of natural numbers in given range
Learn to Code and Code to Learn
Your Journey to Code Mastery
Example Input Input upper limit: 10 Output Sum of natural numbers 1-10: 55 Program to find sum of natural numbers in given range
Example Input Input upper limit: 10 Output Odd numbers between 1 to 10: 1, 3, 5, 7, 9 Logic to print odd numbers from 1 to n without if statement
Example Input Input upper range: 10 Output Even numbers between 1 to 10: 2, 4, 6, 8, 10 Program to print even numbers without using if statement
Example Input Output Alphabets: a, b, c, d, e, … , z Program to display alphabets using ASCII value
Example Input Input N: 10 Output Natural numbers from 10-1 in reverse: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 Program to print natural number in reverse in given range
Example Input Input upper limit to print natural numbers: 10 Output Natural numbers from 1 to 10: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
ExampleInput 5.2 – 3 Output 2.2 Logic to create calculator using switch…case Step by step descriptive logic to create menu driven calculator that performs all basic arithmetic operations. Input two numbers and a character from user in the given format. Store them in some variable say num1, op and num2. Switch the value of op i.e. switch(op). There are four possible values of op i.e. ‘+’, ‘-‘, ‘*’ and ‘/’. For case…
Read More “C program to create calculator using switch case and functions” »
ExampleInput Input a: 4 Input b: -2 Input c: -10 Output Root1: 1.85 Root2: -1.35
ExampleInput Input number: 23 Output 23 is positive
ExampleInput Input number: 12 Output Even number