answersLogoWhite

0

#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

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

ReneRene
Change my mind. I dare you.
Chat with Rene
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve

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.