Click here to Skip to main content
15,896,557 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# addins can not implement MC++ interface? Pin
tiancaidao9-Feb-06 22:32
tiancaidao9-Feb-06 22:32 
Questionint.Parse for percentage values Pin
Luis Alonso Ramos9-Feb-06 16:00
Luis Alonso Ramos9-Feb-06 16:00 
QuestionDropDownList/ListItem Problem Pin
TheMajorRager9-Feb-06 12:53
TheMajorRager9-Feb-06 12:53 
AnswerRe: DropDownList/ListItem Problem Pin
George L. Jackson9-Feb-06 16:06
George L. Jackson9-Feb-06 16:06 
GeneralRe: DropDownList/ListItem Problem Pin
TheMajorRager10-Feb-06 5:34
TheMajorRager10-Feb-06 5:34 
AnswerRe: DropDownList/ListItem Problem Pin
TheMajorRager10-Feb-06 7:59
TheMajorRager10-Feb-06 7:59 
QuestionActive Directory Pin
gjsantana9-Feb-06 12:03
gjsantana9-Feb-06 12:03 
AnswerRe: Active Directory Pin
osamahmirza9-Feb-06 17:35
osamahmirza9-Feb-06 17:35 
QuestionBuild a message pump for a Windows service? Pin
BlackDice9-Feb-06 11:50
BlackDice9-Feb-06 11:50 
AnswerRe: Build a message pump for a Windows service? Pin
George L. Jackson9-Feb-06 15:07
George L. Jackson9-Feb-06 15:07 
GeneralRe: Build a message pump for a Windows service? Pin
BlackDice10-Feb-06 6:11
BlackDice10-Feb-06 6:11 
GeneralI GOT IT!! Pin
BlackDice10-Feb-06 9:27
BlackDice10-Feb-06 9:27 
QuestionDesign form Error Pin
emran8349-Feb-06 11:22
emran8349-Feb-06 11:22 
Questionproblem in while and for loops Pin
Dr.Sammer9-Feb-06 10:40
Dr.Sammer9-Feb-06 10:40 
AnswerRe: problem in while and for loops Pin
Judah Gabriel Himango9-Feb-06 10:48
sponsorJudah Gabriel Himango9-Feb-06 10:48 
AnswerRe: problem in while and for loops Pin
User 66589-Feb-06 10:49
User 66589-Feb-06 10:49 
GeneralRe: problem in while and for loops Pin
Dr.Sammer9-Feb-06 11:00
Dr.Sammer9-Feb-06 11:00 
GeneralRe: problem in while and for loops Pin
User 66589-Feb-06 11:07
User 66589-Feb-06 11:07 
GeneralRe: problem in while and for loops Pin
Dr.Sammer9-Feb-06 11:10
Dr.Sammer9-Feb-06 11:10 
GeneralRe: problem in while and for loops Pin
User 66589-Feb-06 11:13
User 66589-Feb-06 11:13 
GeneralRe: problem in while and for loops Pin
Dr.Sammer9-Feb-06 11:19
Dr.Sammer9-Feb-06 11:19 
GeneralRe: problem in while and for loops Pin
User 66589-Feb-06 11:22
User 66589-Feb-06 11:22 
GeneralRe: problem in while and for loops Pin
Dr.Sammer9-Feb-06 11:26
Dr.Sammer9-Feb-06 11:26 
GeneralRe: problem in while and for loops Pin
LongRange.Shooter10-Feb-06 2:14
LongRange.Shooter10-Feb-06 2:14 
First: here is your code:
<br />
int numb;<br />
long fac = 1;<br />
Console.WriteLine("Enter a number :");<br />
numb = Int32.Parse(Console.ReadLine());<br />
<br />
for ( int numb; numb >0; numb--)<br />
{<br />
fac*=numb--;<br />
}<br />


Now look at what you are doing. int numb; defines a new object numb that is an integer.
numb = blah sets that integer to a number entered by the user.

for (int numb; numb>0; numb--) creates a new instance of numb which (since it is not nullable) gets a new value of 0. So what does your conditional do when it encounters that 0 value? My guess is you always get an answer of 1. Why? (look at it and answer this yourself)

So now you should be able to figure it out...that you need to change your initial storage name (ie. not numb) then set your for loop value int numb to the value you established in the Console.Read function.

There are 10 kinds of people in the world.

Those that read binary...

...and those who don't.

QuestionArray declaration without specifying the size. Pin
emran8349-Feb-06 10:38
emran8349-Feb-06 10:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.