c program to calculate the sum of odd and even numbers

Solutions on MaxInterview for c program to calculate the sum of odd and even numbers by the best coders in the world

showing results for - "c program to calculate the sum of odd and even numbers"
Gauthier
19 Nov 2016
1#include <stdio.h>void main(){int i, number, odd_sum = 0, even_sum = 0;printf("Enter the value of number\n");scanf("%d", &number);for (i = 1; i <= number; i++){if (i % 2 == 0)even_sum = even_sum + i;elseodd_sum = odd_sum + i;}printf("Sum of all odd numbers = %d\n", odd_sum);printf("Sum of all even numbers = %d\n", even_sum);}
queries leading to this page
sum of odd numbers from 1 to 10 in chow to calculate the sum of 10 odd numbers series in csum of odd numbers till 10 in cwrite a c program to count total number of even and odd elements in an array write a c program to count total number of even and odd elements in an arraodd numbers sum with even squares c programcalculate the sum of odd numbers using for loop in c programsum of even digits in chow to find the sum of odd numbers and average csum even number cprogram to find sum of odd numbers in given range in csum of even numbers c programto count number of even and odd digits in codd numbers program in cprint sum of even numbers in c by using whilecalculate the sum of odd numbers using for loop c programseparate odd and even numbers in number and add them ca c program to find sum of all odd numbers between 1 to n sum even integer csum of even or odd in cwrite a program print sum of even and odd numbers of an array in c programodd and even numbers cwrite a c program to count total number of even and odd elements in an array write a c program to find sum of all even numbers between 1 to naddition of odd numbers in cwrite a program to display all odd numbers between m and n c programingc program to find sum of odd numbers from 1 to nwrite a c program that computes the sum of even and odd numbers stored in an array of n integersc program to calculate the sum of odd and even numbers using for loopa c program to find sum of all odd numbers between 1 to n calculate odd numbers in ca c program to find sum of all even numbers between 1 to n sum of odd numbers in chow to sum only even numbers cc program to calculate the sum of odd numbers using for loop in c programc program to calculate the sum of odd and even numbers using for loophow to find sum of odd number in c programcalculate the sum of odd numbers using for loop in c programsum of odd number using array in cc program for sum of n even numberssum of all odd numbers between 2 number in cwrite a c program to print sum of all odd numbers between 1 to n even and odd numbers in cwrite a program to display all odd numbers between m and n csum of odd and even digits in a number in csum of all odd numbers in cc program to calculate the sum of odd and even numbers