Hi, If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. Write a function called number2letters that returns the number of letters needed to write down the number
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, Really no idea how to start this question. PLease help.
댓글 수: 0
채택된 답변
KALYAN ACHARJYA
2018년 7월 30일
편집: KALYAN ACHARJYA
2018년 7월 30일
Here Answer:
n=input('Enter the number: ');
words_number=num2words(n);
disp(words_number);
str=upper(words_number(:));
AZ='A':'Z';
count=sum(ismember(str,AZ));
fprintf('The numbers of letter: %d',count);
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!