🔒 Closed Patulong po mga master

Status
Not open for further replies.

Behelit

Eternal Poster
Pwede po bang pasagot nito, helping a friend po kanina pa po kasi nya di nasasagutan, salamat mga sir/ma'am in advance, C# Language po
 

Attachments

  • 68853F41-904D-4962-B207-F4AD1EC05868.webp
    68853F41-904D-4962-B207-F4AD1EC05868.webp
    28.3 KB · Views: 17
static void Main(string[] args)
{
int i = 0;
string str = "";
getNumber(str, i);
}

public static void getNumber(string s, int x)
{
int i;

while(x != 5)
{
Console.Write("Enter a number : ");
i = int.Parse(Console.ReadLine());
if (i <= 1 || i % 2 != 0 || i > 100)
{
Console.WriteLine("invalid input!");
getNumber(s, x);
}
else
{
s += i + " ";
getNumber(s, x + 1);
}
}
Console.WriteLine("output : " +s);
Console.ReadLine();
}

hindi ko alam kung tama yan sir. hindi ko pa natry. try mo na lang.
 
static void Main(string[] args)
{
int i = 0;
string str = "";
getNumber(str, i);
}

public static void getNumber(string s, int x)
{
int i;

while(x != 5)
{
Console.Write("Enter a number : ");
i = int.Parse(Console.ReadLine());
if (i <= 1 || i % 2 != 0 || i > 100)
{
Console.WriteLine("invalid input!");
getNumber(s, x);
}
else
{
s += i + " ";
getNumber(s, x + 1);
}
}
Console.WriteLine("output : " +s);
Console.ReadLine();
}

hindi ko alam kung tama yan sir. hindi ko pa natry. try mo na lang.
Sir di po nagana yung syntax na getNumber sa visual, baka po may other syntax na kapareho nyan na mababasa sa visual para ma get yung number ng strings? thank you po!
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 263
    Views
  • 2
    Participants
Last reply from:
Behelit

Trending Topics

Online now

Members online
1,077
Guests online
3,658
Total visitors
4,735

Forum statistics

Threads
2,306,633
Posts
29,173,142
Members
1,193,961
Latest member
Antagonist123
Back
Top