Results 1 to 2 of 2

Thread: learning C programming language

  1. #1
    HernandezOrtiz is offline Senior Member
    Join Date
    Dec 2009
    Posts
    301
    Rep Power
    3

    Default learning C programming language

    I am new in programming word. I am started learning C programming language. I want to write one C program code to count numbers of negative & positive numbers. Suppose we provide 5 positive and 6 negative number then output result should show the count of positive number as 5 and count of negative number as a 6. I tried various methods but none of them worked out. Any help would be highly appreciated.

  2. #2
    MartinWilson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    281
    Rep Power
    3

    Default

    Try out this code, which is solving your problem. Copy and paste the code and check it.

    Code:
    void funcv(int numv int * arrv int *pos int *neg)
    {
    Int a 0;
    *pos 0;
    *neg 0;
    for(a= 0; a < numv; a++)
    {
    if(*(arrv + a) > 0)
    (*pos)++;
    else
    (*neg)++;
    }
    return;
    }
    void main()
    {
    int array[] {1 2 3 4 5 -4 -6 -8 0};
    int pos neg;
    func(&pos, &neg);
    return;
    }

Similar Threads

  1. web form using asp.net programming language
    By BellWard in forum Programming
    Replies: 3
    Last Post: 07-07-2010, 02:10 PM
  2. JAVA programming language
    By SmithJohnson in forum Programming
    Replies: 1
    Last Post: 02-19-2010, 12:52 PM
  3. Most Useful Linux Related Programming Language(s)
    By Damario Elonzo in forum Linux/Free BSD
    Replies: 2
    Last Post: 08-18-2009, 07:05 AM
  4. GNUSim8085 Assembly language programming
    By uncosto46 in forum Programming
    Replies: 0
    Last Post: 08-02-2008, 11:11 AM
  5. Erlang a programming language
    By ostin55 in forum Programming
    Replies: 0
    Last Post: 07-30-2008, 06:35 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48