+ 1
How to count element of array from input in c language?
Example I define int arr[100], but when I input array in scanf, I put only 5 element (example : 7,4,7,3,8). How I count the element, so the output is 5? If I use sizeof, the output is become 100.
4 Antworten
+ 3
You can already count the elements while they are being inputted or you already know how many times to ask for input ,
+ 2
Briana yes
+ 1
Briana You can use a counter for the dupes and then print the total of all the numbers read minus the total of the dupes.
https://code.sololearn.com/c0z7H4AeVWMq/?ref=app
0
Abhay I know.. But, I want to count the same element as one. So, if I scanf 8,5,3,7,8 example, the output is 4. Shouldn't I count the whole elements first?