What's new

Visual Basic SOLVED

Status
Not open for further replies.

Yaboku

Forum Veteran
Joined
Oct 12, 2016
Posts
1,936
Reaction
626
Points
677
Hi po paturo naman neto kanina pako nahirapan neto eh. Sumakit na ulo ko puro failed . Ang hirap sobra.
Willing to give tip sa makakabigay ng code.
Eto po dapat output niya.
1.
6OzPAnq9jYkmLiifnf0rb-rBVG1Ua_ZrcF9qqE7RSUHwLGYs1sfYKRy_3E9la0AD0jvG-o_FNRI4FJOOPD7ljV-i2sTbV_x3fhZ1q4bjymf-DRS-2YTGjTX3f-hbpHh9_ItN0X5i


2.
HcrG02RJZdTebk0w1NWEHDOL7hlz6AWS1X9y0vR7ZZF6QgQxSbskTNRA3gsUPKqdxMY7jI9XuivyQRfMMFWYZiKRYHUQZKBERxd3BzyvKl9AuOlMCFy1G8t-96dqpxMUv9pHSOzx
 
tingin ako code mo sir
Public Sub Main(args() As string)
Dim n, i, j As Integer
Dim m As Integer = 1
Console.WriteLine(" Enter the number of rows")
n = Console.ReadLine() ' take an input from the user

For i = 1 To n ' outer loop decremented by 1
For j = 1 To i ' value of j is less than i
Console.Write("{0} ", j) ' print the value of i
Next

Console.WriteLine("") ' jump to next line at each iteration
Next
Console.Readline()
End Sub
End Module
 
sir ayos lang sayo ibang programming language, di ko alam vb net pero alam ko yung logic niyang program na yan

C program code:

C:
#include <stdio.h>



int main(){

  int n=0;

  printf("enter a number: "); scanf("%d", &n);

  for(int i=0;i<n;i++){

    for(int j=i+1;j<n+1;j++){

      printf("%d\t", j);

      if(j==n){

        printf("\n");

      }

    }

  }

 

  printf("\n\n\n\n");

 

 

 

  for(int i=0;i<n;i++){

    for(int j=n-i;j<n+1;j++){

      printf("%d\t", j);

      if(j==n){

        printf("\n");

      }

    }

  }

}



C program Ouput
1648896308394.png
 

Attachments

Last edited:
Code:
TASK 1
For r = 1 to 9
  For c=r to 9
    PRINT C
    PRINT " "
  EndFor
  PRINT "\N"
EndFor

TASK 2
For r = 10 to 1
  For c=r to 10
    PRINT C
    PRINT " "
  EndFor
  PRINT "\N"
EndFor
Good Luck!
 
Yaboku Translation to C# sa answer ni laxus456 para mas madali mong matranslate to VB.Net


C#:
Console.Write("Enter a number: ");
int num = Convert.ToInt32(Console.ReadLine());
int i, j;
for (i = 0; i < num; i++){
    for (j = i + 1; j < num + 1; j++){
        Console.Write(j + "\t");
        if (j == num){
            Console.WriteLine("");
        }
    }
}

C#:
Console.Write("Enter a number: ");
int num = Convert.ToInt32(Console.ReadLine());
int i, j;
for (i = 0; i < num; i++){
    for (j = num - i; j < num + 1; j++){
        Console.Write(j + "\t");
        if (j == total){
            Console.WriteLine("");
        }
    }
}
 
Last edited:
Eto try mo sa VB.Net (Translated from C++)
All credit to laxus456
Nakisali lang ako walang magawa eh =D

C#:
Public Module Program
    Public Sub Main(args() As string)
        Dim num As Integer = 0
        Console.Write("Enter an integer value: ")
        num = Convert.ToInt32(Console.ReadLine())
       
        Dim i, j As Integer
        For i = 0 To num - 1
            For j = i + 1 To num + 1 - 1
                Console.Write(j & vbTab)

                If j = num Then
                    Console.WriteLine("")
                End If
            Next
        Next
    End Sub
End Module

C#:
Public Module Program
    Public Sub Main(args() As string)
        Dim num As Integer = 0
        Console.Write("Enter an integer value: ")
        num = Convert.ToInt32(Console.ReadLine())
       
        Dim i, j As Integer
        For i = 0 To num - 1
            For j = num - i To num + 1 - 1
                Console.Write(j & vbTab)

                If j = num Then
                    Console.WriteLine("")
                End If
            Next
        Next
    End Sub
End Module
 
Code:
TASK 1
For r = 1 to 9
  For c=r to 9
    PRINT C
    PRINT " "
  EndFor
  PRINT "\N"
EndFor

TASK 2
For r = 10 to 1
  For c=r to 10
    PRINT C
    PRINT " "
  EndFor
  PRINT "\N"
EndFor
Good Luck!
Kuya pm po

Eto try mo sa VB.Net (Translated from C++)
All credit to laxus456
Nakisali lang ako walang magawa eh =D

C#:
Public Module Program
    Public Sub Main(args() As string)
        Dim num As Integer = 0
        Console.Write("Enter an integer value: ")
        num = Convert.ToInt32(Console.ReadLine())
      
        Dim i, j As Integer
        For i = 0 To num - 1
            For j = i + 1 To num + 1 - 1
                Console.Write(j & vbTab)

                If j = num Then
                    Console.WriteLine("")
                End If
            Next
        Next
    End Sub
End Module

C#:
Public Module Program
    Public Sub Main(args() As string)
        Dim num As Integer = 0
        Console.Write("Enter an integer value: ")
        num = Convert.ToInt32(Console.ReadLine())
      
        Dim i, j As Integer
        For i = 0 To num - 1
            For j = num - i To num + 1 - 1
                Console.Write(j & vbTab)

                If j = num Then
                    Console.WriteLine("")
                End If
            Next
        Next
    End Sub
End Module
Thank you po
 
Ganito ba?

Code:
Module Module1

    Sub Main()
        Dim n, i, j As Integer
        Dim m As Integer = 1
        Console.WriteLine(" Enter the number of rows")
        n = Console.ReadLine() ' take an input from the user

        For i = n To 1 Step -1

            For j = i To n
                Console.Write("{0} ", j)
            Next
            Console.WriteLine("")
        Next

        Console.ReadLine()
    End Sub

End Module
 
Eto try mo sa VB.Net (Translated from C++)
All credit to laxus456
Nakisali lang ako walang magawa eh =D

C#:
Public Module Program
    Public Sub Main(args() As string)
        Dim num As Integer = 0
        Console.Write("Enter an integer value: ")
        num = Convert.ToInt32(Console.ReadLine())
      
        Dim i, j As Integer
        For i = 0 To num - 1
            For j = i + 1 To num + 1 - 1
                Console.Write(j & vbTab)

                If j = num Then
                    Console.WriteLine("")
                End If
            Next
        Next
    End Sub
End Module

C#:
Public Module Program
    Public Sub Main(args() As string)
        Dim num As Integer = 0
        Console.Write("Enter an integer value: ")
        num = Convert.ToInt32(Console.ReadLine())
      
        Dim i, j As Integer
        For i = 0 To num - 1
            For j = num - i To num + 1 - 1
                Console.Write(j & vbTab)

                If j = num Then
                    Console.WriteLine("")
                End If
            Next
        Next
    End Sub
End Module
Up dito, di ganyan code ko pero this works perfectly hahahahahahahaha
 
Up dito, di ganyan code ko pero this works perfectly hahahahahahahaha

Thanks pero credit kay laxus456
Also pwede rin actually di na icheck kung equal yung j sa num. Direct Console.Writeline nalang after Next


C#:
Dim num As Integer = 0
Console.Write("Enter an integer value: ")
num = Convert.ToInt32(Console.ReadLine())

Dim i, j As Integer
For i = 0 To num - 1
    For j = num - i To num + 1 - 1
        Console.Write(j & vbTab)
    Next
    Console.WriteLine("")
Next
 
sir ayos lang sayo ibang programming language, di ko alam vb net pero alam ko yung logic niyang program na yan

C program code:

C:
#include <stdio.h>



int main(){

  int n=0;

  printf("enter a number: "); scanf("%d", &n);

  for(int i=0;i<n;i++){

    for(int j=i+1;j<n+1;j++){

      printf("%d\t", j);

      if(j==n){

        printf("\n");

      }

    }

  }

 

  printf("\n\n\n\n");

 

 

 

  for(int i=0;i<n;i++){

    for(int j=n-i;j<n+1;j++){

      printf("%d\t", j);

      if(j==n){

        printf("\n");

      }

    }

  }

}



C program Ouput
View attachment 1882458
Thank you po 😊

Nakuha napo yung code. Maraming salamat po sa inyo
 
Last edited:
Status
Not open for further replies.

Similar threads

Back
Top