{{#items}}

{{text}}

{{/items}} {{ctaText}}

{{#items}} {{/items}}

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);}`

similar questions

sum of individual digits in c using functiona program to find the numbers of positive 2c negative 2c odd and even numbers in a set of numbers in ceven odd cmultiplication of two numbers in cc defined value sumsum of digits in c using for loopwrite a c program to calculate sum of the perfect numbers within a given number of range using function find sum of individual column of a matrix in codd even in cc program to find the sum of given numberc code for even numbrrsuse 26 to check even and odd in chow to know if a number is even in cc program to addition of two numberseven odd numer caddition of two numbers in cfind sum of individual row of a matrix in cqueries 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 your answer for

you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content

please ensure to add code which is syntactically corrent and executes properly

ask question on maxinterview

you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content

please be clear, to the point and respectful