Thread: How count a repeated number in my data?

  1. #1
    Registered User
    Join Date
    Sep 2017
    Posts
    1

    Exclamation How count a repeated number in my data?

    Hi everyone

    I want to write a code which can count how many number 1 are there in my data?
    Code:
    for (rowIndex = 0; rowIndex < MAX_ROWS; rowIndex++)	{
    		for (columnIndex = 0; columnIndex < MAX_COLUMNS; columnIndex++)
    i don't know how to continue this!

  2. #2
    Registered User
    Join Date
    Jun 2017
    Posts
    157
    Outside your loops declare a counter and set it to 0.
    Inside your loop you check if the data at the row and col is == 1.
    If yes you increment your counter.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. count repeated word
    By Gaily Guzon in forum C Programming
    Replies: 4
    Last Post: 09-28-2013, 11:48 AM
  2. Count the repeated numbers
    By aries0152 in forum C++ Programming
    Replies: 3
    Last Post: 07-12-2013, 11:55 PM
  3. Number repeated thrice
    By anirban in forum Tech Board
    Replies: 19
    Last Post: 03-26-2010, 09:34 AM
  4. Replies: 5
    Last Post: 01-28-2009, 04:34 PM
  5. count/display non-repeated element of array
    By azsquall in forum C++ Programming
    Replies: 15
    Last Post: 07-10-2008, 09:42 AM

Tags for this Thread