Determine if input is a perfect number
A perfect number occurs whent the sum of all divisors of a positive integer, except the number itself, equals the number.
Examp...
7개월 전
문제를 풀었습니다
Ripping numbers apart!
So you have to "rip" a number apart into individual digits... The end output is a cell.
That is if:
x = 12345678
o...
7개월 전
문제를 풀었습니다
Maximum value in a matrix
Find the maximum value in the given matrix.
For example, if
A = [1 2 3; 4 7 8; 0 9 1];
then the answer is 9.
7개월 전
문제를 풀었습니다
Increment a number, given its digits
Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...
Numbers spiral diagonals (Part 2)
Inspired by Project Euler n°28 and 58.
A n x n spiral matrix is obtained by starting with the number 1 and moving to the right ...
7개월 전
문제를 풀었습니다
Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example:
[q,r] = swap(5,10)
returns q = ...
Octoberfest festival
A group of students decided to visit Octoberfest festival. First they ordered one beer, then after half-hour they taken one more...