필터 지우기
필터 지우기

Write a single line code to sum all the odd numbers of an array.

조회 수: 1 (최근 30일)
Abhi Jain
Abhi Jain 2016년 10월 4일
댓글: Abhi Jain 2016년 10월 4일
The code should contain only one line.

채택된 답변

Abhishek Jain
Abhishek Jain 2016년 10월 4일
You can use this code:
y = sum(x(rem(x,2)==1));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by