Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,844 questions

51,765 answers

573 users

How to write the 7 BOOM game. If a number divide by 7 OR include the digit 7, print "BOOM". The input is 1-99 in VB.NET

2 Answers

0 votes
Imports System

Public Class Game7BOOM_VB_NET
    Public Shared Sub Main(ByVal args As String())
        Console.Write("Enter a number between 1 to 99: ")
        Dim n As Integer = Integer.Parse(Console.ReadLine())

        If n Mod 7 = 0 OrElse n / 10 = 7 OrElse n Mod 10 = 7 Then
            Console.WriteLine("BOOM")
        Else
            Console.WriteLine(n)
        End If
    End Sub
End Class



' run:
'
' Enter a number between 1 to 99: 17
' BOOM
'

 



answered Aug 29, 2024 by avibootz
edited Aug 29, 2024 by avibootz
0 votes
Imports System

Public Class Game7BOOM_VB_NET
    Public Shared Sub Main(ByVal args As String())
        Console.Write("Enter a number between 1 to 99: ")
        Dim limit As Integer = Integer.Parse(Console.ReadLine())

        For i As Integer = 1 To limit
            If i Mod 7 = 0 OrElse i / 10 = 7 OrElse i Mod 10 = 7 Then
                Console.WriteLine("BOOM")
            Else
                Console.WriteLine(i)
            End If
        Next
    End Sub
End Class




' run:
'
' Enter a number between 1 to 99: 30
' 1
' 2
' 3
' 4
' 5
' 6
' BOOM
' 8
' 9
' 10
' 11
' 12
' 13
' BOOM
' 15
' 16
' BOOM
' 18
' 19
' 20
' BOOM
' 22
' 23
' 24
' 25
' 26
' BOOM
' BOOM
' 29
' 30
'

 



answered Aug 29, 2024 by avibootz
edited Aug 29, 2024 by avibootz
...