How many Integers? - MATLAB Cody - MATLAB Central

Problem 44454. How many Integers?

Difficulty:Rate

Count the integers in a given vector v.

You must use a loop to count each element separately.

Examples:

Input:  v = [1.6, 5.7, 8, -3, 5.3, 9.0, -1, 0, 12]
Output: n = 6    (9.0 is also an integer)
Input:  v = [1.2, 2.3, 4.5]
Output: n = 0

Solution Stats

36.33% Correct | 63.67% Incorrect
Last Solution submitted on Mar 08, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers462

Suggested Problems

More from this Author25

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page