Use Fprintf or disp or which function to print pyramid

Dear MATLAB TEAM I have questions regarding some printing issues 1- i got a request to print the following triangle A1 as top of the triangle A1A2 A1A2A3 A1A2A3A4 . . A1A2A3A4A5A6A7A8A9A10 as a base --------------------------- 2- i couldn't solve this issue: A twin primes is a pair of prime numbers such that the difference between them is 2 (for example, 17 and 19). Write a computer program that finds all the twin primes between 10 and 500. The program displays the results in a two-column matrix in which each row is a twin prime. “You are allowed to use primes MATLAB command to generate the prime’s numbers “. -----------------------------------

Answers (1)

Use fprintf() to print the triangle.
You did not ask any question about the twin primes.

1 Comment

how to do it this way like in the image i try my best but i couldnt mix A with digits </matlabcentral/answers/uploaded_files/50933/Triangle.png>

Sign in to comment.

Asked:

on 28 Apr 2016

Edited:

on 28 Apr 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!