How can i count numbers on odd/even places?
I want to count the sum of digits in odd places and in even places , and after that their difference
we know that first digit it's from the right side
How can I do it with switch?
For example :
A number 23543 :
sum of digits in even places:7 (3+4=7 even places)
sum of digits in odd places:10 ( 2+5+3=10 odd places)
difference: -3 (7-10)
Re: How can i count numbers on odd/even places?
When you scanf() you leave the '\n' on the buffer. Thus, when you call getchar() you get the newline and don't let the user enter something. Your printf() calls need to have a format pattern in the message text. You don't use the "Enter E or e" to quit. The program quits anyhow. You might want to put a while(ch != 'e' || ch != 'E') in your program.
|Tags: count numbers, switch|
|Thread Tools||Search this Thread|
|Similar Threads for: "How can i count numbers on odd/even places?"|
|Thread||Thread Starter||Forum||Replies||Last Post|
|How to change negative numbers to positive numbers in Excel||Shaina Na||Microsoft Project||3||08-01-2012 05:35 PM|
|Need C program code to count numbers of negative & positive numbers||Sarfaraj Khan||Software Development||5||16-01-2010 02:00 PM|
|How to count numbers from a table in C language||MKAIF||Software Development||3||01-10-2009 10:34 PM|
|SQL Query for Searching Missing Numbers from Sequence of Numbers||Bhagwandas||Software Development||3||18-02-2009 01:47 PM|
|How to Use Chapter Numbers with Page Numbers In Ms Word||Braze||Windows Software||3||27-12-2008 07:01 PM|