Quote:
But I need to add one thing in my code that how to calculate how many odd/even numbers are in the list.
How can you write correct code to list odd and even numbers and be unable to count them?
Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
#include <stdio.h>
int main()
{
int i, j;
int X=10;
for(i=1;i<=X;i++)
{
printf("%d\t", i);
}
printf("\n");
for(i=1;i<=X;i++)
{
if((i%2)==0)
{
printf(" The Even number are: %d\n", i);
}
}
printf("\n");
for(i=1;i<=X;i++)
{
if((i%2)!=0)
{
printf(" The odd number are: %d\n", i);
}
}
return 0;
}
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]