C program to find sum of odd numbers from 1 to n

Write a C program to find sum of all odd numbers from 1 to n using for loop. How to find sum of all odd numbers in a given range in C programming. Logic to find sum of odd numbers in a given range using loop in C programming.

Example

Input

Input upper limit: 10

Output

Sum of odd numbers from 1-10: 25

Read more

C program to find sum of even numbers between 1 to n

Write a C program to input number from user and find sum of all even numbers between 1 to n. How to find sum of even numbers in a given range using loop in C programming. Logic to find sum of even numbers in a given range in C program.

Example

Input

Input upper limit of even number: 10

Output

Sum of even numbers between 1 to 10: 30

Read more

C program to print all odd numbers from 1 to n

Write a C program to print all odd numbers from 1 to n using for loop. How to print odd numbers from 1 to n using loop in C programming. Logic to print odd numbers in a given range in C programming.

Example

Input

Input upper limit: 10

Output

Odd numbers between 1 to 10:
1, 3, 5, 7, 9

Read more

C program to print all even numbers from 1 to n

Write a C program to print all even numbers from 1 to n using for loop. C program to generate all even numbers between given range. Logic to print even numbers using if else and for loop in given range in C programming.

Example

Input

Input upper range: 10

Output

Even numbers between 1 to 10:
2, 4, 6, 8, 10

Read more

C program to print alphabets from a to z

Write a C program to print alphabets from a to z using for loop. How to print alphabets using loop in C programming. Logic to print alphabets from a to z using for loop in C programming.

Example

Input

Output

Alphabets: a, b, c, ... , x, y, z

Read more

C program to print all natural numbers from 1 to n

Write a C program to print all natural numbers from 1 to n using loop. C program to print first n natural numbers using loop. How to print natural numbers in a given range using loop. Logic to print natural numbers using for loop in C program.

Example

Input

Input upper limit: 10

Output

Natural numbers from 1 to 10: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Read more

Project Euler 2: Even Fibonacci numbers

Problem: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … By considering the terms in the Fibonacci sequence whose values do not exceed four million, find … Read more

C program to check even or odd number using switch case

Write a C program to input number from user and check whether the number is even or odd using switch case. How to check even or odd using switch case in C programming. Logic to check whether a number is even or odd using switch case in C program.

Example
Input

Input number: 12

Output

Even number

Read more