Matlab Write Code Matlab Using Loops Find Sum 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Q37119697

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)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.