>The problem actually is i dont get the corect no of spolit ballots...i get it as 4325678>

between line 10 where you declare the variable called invalid and line 26 where you increment the variable called invalid by one you never initialize/assign the variable called invalid to any given value, so it's junk. In you increment junk by one you still get junk. When you display the variable called invalid you will display junk. To correct this problem you need need initialize/assign the variable called invalid to some valid value before you try to increment/output it or use it in some other way (the same goes for all other variables you will ever use as well so learn the lesson well or you are doomed to repeat it indefinitely). In this case you probably want to initialize/assign the value called invalid to zero some place between line 10 and line 26, say maybe make line 11 look like this:

invalid = 0;

thanks alot..i could nt have done it without your help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.