ML8 - Matlab 8 Triplets Problem! Tian Gu ID: 853324472 The...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Matlab 8 Triplets Problem! Tian Gu ID: 853324472 The Triplet Problem Introduction : Last time I came out some clues to solve the triplet problem (triplet: number =a*b*c), this time I will try to work this out by program. To prevent the previous work which may interfere with the progress of the program, we always clear all first. close all clear all clc Now we should ask the user to input a number. numb = input( 'Please input a integer number: ' ); I think the best way to solve this is still using for loop which I mentioned in last report. The triplet has three numbers each column. So what about we loop every number and find the satisfied combinations? Anyway, we set a, b, c at first for a = 1:numb for b = 1:numb for c =1:numb Now we should consider the condition they should satisfied which is the set of numbers can be only displayed once. This means the three numbers cannot appear in other order again. So we can we put this restriction in this program.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 11/17/2011.

Page1 / 5

ML8 - Matlab 8 Triplets Problem! Tian Gu ID: 853324472 The...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online