🔒 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: 15
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.

Similar threads

About this Thread

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

Trending Topics

Online now

Members online
1,124
Guests online
1,005
Total visitors
2,129

Forum statistics

Threads
2,273,776
Posts
28,951,512
Members
1,234,951
Latest member
Gabskie
Back
Top