Matlab
Write a code in matlab using loops to find the sum of1^1+2^2+3^3+4^4+5^5+6^6+7^7+8^8+9^9+10^10
Answer
total = 0;for i=1:10 t = 1; for j=1:i t = t*i; end total = total+t;endfprintf(“Sum = %dn”, total)
Matlab
Write a code in matlab using loops to find the sum of1^1+2^2+3^3+4^4+5^5+6^6+7^7+8^8+9^9+10^10
Answer
total = 0;for i=1:10 t = 1; for j=1:i t = t*i; end total = total+t;endfprintf(“Sum = %dn”, total)