Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

V shape star pattern in MATLAB

MATLAB Program:


x=input('Enter the number:');
y=[];%output
for i=1:x
    for j=1:(2*x-1)
        if(i==j || i+j==2*x)
            y(i,j)='*';
        end
    end
end
z=char(y);
disp(z);


OUTPUT:

No comments

Popular Posts

Followers