answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int oddSum = 0, evenSum = 0, i = 0;

char n[50] = {0};

clrscr();

printf("Enter the number : ");

scanf("%s", n);

while(n[i] != '\0')

{

if(i % 2 == 0)

oddSum = oddSum + (n[i] - 48);

else

evenSum = evenSum + (n[i] - 48);

++i;

}

printf("Odd sum is %d and even sum is %d\n", oddSum, evenSum);

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: To find sum of odd position digits and even position digits separately?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Other Math

How many even two digit numbers are there where the sum of the digits is 5?

To find the even two-digit numbers where the sum of the digits is 5, we need to consider the possible combinations of digits. The digits that sum up to 5 are (1,4) and (2,3). For the numbers to be even, the units digit must be 4, so the possible numbers are 14 and 34. Therefore, there are 2 even two-digit numbers where the sum of the digits is 5.


What fraction of all 4 digits natural numbers have a product of their digits that is even?

To find the fraction of 4-digit natural numbers with a product of their digits that is even, we first need to determine the total number of 4-digit natural numbers. There are 9000 such numbers (from 1000 to 9999). Next, we consider the conditions for the product of digits to be even. For a number to have an even product of digits, at least one of the digits must be even. There are 5 even digits (0, 2, 4, 6, 8) and 5 odd digits (1, 3, 5, 7, 9). Therefore, the fraction of 4-digit natural numbers with an even product of digits is 5/10 * 9/10 * 9/10 * 9/10 = 3645/9000 = 809/2000.


What does find the sum of the digits of each number above mean?

Add the digits together. The sum of the digits of 23 is 5.


What happens to the median when you come up with two answer?

when you have an even amount of numbers while trying to find the median, you first find the two numbers that are at the median and then take all the numbers between them and find the median of that. if that amount of digits is also even, then you must have a decimal median.


When you reverse the digits in a certain two-digit number you increase its value by 9 Find the number if the sum of its digits is 7?

34.

Related questions

How many even two digit numbers are there where the sum of the digits is 5?

To find the even two-digit numbers where the sum of the digits is 5, we need to consider the possible combinations of digits. The digits that sum up to 5 are (1,4) and (2,3). For the numbers to be even, the units digit must be 4, so the possible numbers are 14 and 34. Therefore, there are 2 even two-digit numbers where the sum of the digits is 5.


C program to find the sum of odd positioned digits and even positioned digits of a number seperately?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; main() { int n,s,r,t; clrscr(); printf("enter n"); scanf("%d",&amp;n); s=0;t=0; while(n!=0) { r=n%10; { if(r%2!=0) t=t+r; if(r%2==0) s=s+r; } n=n/10; } printf("sum of even position digits%d\n",s); printf("sum of odd position digits%d\n",t); getch(); }


How do you find the last 2 digits of the question 14x13x12x11x10x9x8x7x6x5x4x3x2x1 quickly?

Since there are two multiples of 5, and plenty of even numbers, the last two digits are 00.


What fraction of all 4 digits natural numbers have a product of their digits that is even?

To find the fraction of 4-digit natural numbers with a product of their digits that is even, we first need to determine the total number of 4-digit natural numbers. There are 9000 such numbers (from 1000 to 9999). Next, we consider the conditions for the product of digits to be even. For a number to have an even product of digits, at least one of the digits must be even. There are 5 even digits (0, 2, 4, 6, 8) and 5 odd digits (1, 3, 5, 7, 9). Therefore, the fraction of 4-digit natural numbers with an even product of digits is 5/10 * 9/10 * 9/10 * 9/10 = 3645/9000 = 809/2000.


Which is greater of two positive numbers?

It's the number that has more digits to the left of the decimal point (if there is no decimal point, it's the number with more digits). If the number of digits to the left of the decimal point is the same, find the position farthest to the left where the digits are different. The number with the greater of those two digits is the greater number. For example, 10000 is greater than 9999 because 10000 has more digits, and 6350 is greater than 6349 because the farthest-left position that is different is the tens place, and 5 is greater than 4.


How do you find the sum of digits of each number?

Add the digits together. The sum of the digits of 23 is 5.


How many integers between 1000 and 9999 are even digits?

Oh, what a lovely question! To find the number of integers between 1000 and 9999 with all even digits, we can think of each digit place (ones, tens, hundreds, thousands) independently. In each place, we have 5 even digits to choose from (0, 2, 4, 6, 8). So, we have 5 choices for each of the 4 places, giving us a total of 5 x 5 x 5 x 5 = 625 integers with all even digits. Happy counting!


Shell program to find the sum of cube of individual digits of a number?

Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.


What does find the sum of the digits of each number above mean?

Add the digits together. The sum of the digits of 23 is 5.


What happens to the median when you come up with two answer?

when you have an even amount of numbers while trying to find the median, you first find the two numbers that are at the median and then take all the numbers between them and find the median of that. if that amount of digits is also even, then you must have a decimal median.


What is the largest three-digit even number that uses the digits 3 4 and 5?

To find the largest three-digit even number using the digits 3, 4, and 5, you need to arrange these digits in descending order to maximize the number, ensuring that the last digit is even. The largest possible even number is 542


How can I make a quick and easy family dinner?

Find a day and make up a bunch of dinners that your family enjoys, and freeze them (You could even freeze the different courses separately so that you can