Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com MATLAB code to display prime numbers?

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 12-06-2011, 04:40 PM PM User | #1 szak1592 New to the CF scene   Join Date: Dec 2011 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts MATLAB code to display prime numbers? Can you guys please help me with a MATLAB code, I need a simple program to display the prime numbers between 1 and 100. Please help as I am new to programming and I have to do it as an assignment.
 12-06-2011, 07:19 PM PM User | #2 alykins Senior Coder     Join Date: Apr 2011 Posts: 1,608 Thanks: 37 Thanked 183 Times in 182 Posts it has been a while since I have done MATLAB (and I did not do a whole lot in it but I will help you with the logic flow so you can figure it out) You cannot post questions on "how do I do this" for assignments, but you can ask for help on why things are not working... this pseudo code may help you Code: ```int[] myNums = new int[100] i=1 totalprime =0 while (i<=100){ bool eval = true cnt = 0 while(eval = true){ for(int y=1; y<=i; y++) if(i%y != 0) eval = false else cnt++ if (y==i) eval false } if(cnt == 2) myNums[totalprime] = i i++ }``` i think that logic flow is correct... take a look at it and tell me if you can figure out what it is doing... a key to doing this is going to be modulus __________________ I code C hash-tag .Net Reference: W3C W3CWiki .Net Lib Validate: html CSS Debug: Chrome FireFox IE

 Bookmarks

 Tags codes, matlab, programming

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 09:23 AM.