• The Facebook Platform

Results 1 to 1 of 1

Thread: even or odd ??

  1. #1
    Join Date
    Jan 2011
    Location
    lahore
    Posts
    51
    Points
    58.63
    Rep Power
    58

    new_new even or odd ??

    assalam
    to day im going to tell u code of a programe which will tell u that a number is even or odd?
    and also it count how many numbers are even and odd .
    it is"nt amazing?????
    so lets start....


    #include<stdio.h>
    void main(void)
    {
    int num;
    int oddcount;
    int evencount;








    printf("\nThis program will ask you to enter numbers and determine whether they are even or odd. It will also count how many of each you entered.\n");
    oddcount=0;
    evencount=0;

    while (num!=999)
    {
    printf("Enter a number: (to stop entering numbers enter 999) ");
    scanf("%d",&num);

    if (num%2 != 0)
    {
    printf("\nThe number %d Is Odd.\n",num);
    oddcount++;
    }
    else
    {
    printf("\nThe number %d Is Even.\n",num);
    evencount++;
    }
    }
    printf("\nThe number of odd numbers entered was %d", oddcount);
    printf("\nThe number of even numbers entered was %d", evencount);

    scanf("%d",num);
    }






    duao me yad rkhna.....









 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •