Click here to Skip to main content
15,878,953 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
if i have selected 1,then print 0-9.
if i have selected passcode as 2,then print 0 to 99.
if i have selected passcode as 3,then print 0 to 999.
and so on...if i have selected passcode as 6,then print 0 to 999999.
Posted
Comments
OriginalGriff 15-Jul-14 3:22am    
And?
What have you tried?
Where are you stuck?
What help do you need?

And why? Either list is homework - in which case you should do it yourself - or your output is gong to be rather predictable...and extensive.
[no name] 15-Jul-14 3:39am    
give the code using matlab?
[no name] 15-Jul-14 3:47am    
%length=input('Enter the length of the passcode:');
flag=0;
passcode=123456789;
code=input('Enter your passcode:');
for i=1:9
m=mod(passcode,10);
n=mod(code,10);
if m==n
flag=0;
continue;
else
flag=1;break;
end
m=passcode/10;
n=code/10;
end
if flag==0
disp('login');
else
disp('passcode incorrect');
end




i done this..but the problem is first to generate the passcode accordingly what i said earlier and then compare with the given password

1 solution

Try this pseudo code.

int s = [select value];

long l = Math.Pow(10, s);
var r = new Random();
long passcode = r.Next(l);
 
Share this answer
 
Comments
[no name] 15-Jul-14 3:41am    
but here, how to check the passcode lenght?
ArunRajendra 15-Jul-14 3:46am    
sorry I am not aware of matlab.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900