answersLogoWhite

0

Function sum_odd_digits(ByVal number As Integer) As Integer

Dim digit As Integer

sum_odd_digits = 0

While number <> 0

digit = number Mod 10

If digit And 1 Then sum_odd_digits = sum_odd_digits + digit

number = number / 10

End While

End Function

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

Write a program to find Armstrong number in visual basic 10?

An Armstrong number (or narcissistic number) for a given number of digits is a number that is equal to the sum of its own digits raised to the power of the number of digits. Here’s a simple Visual Basic 10 program that checks for Armstrong numbers: Module ArmstrongNumber Sub Main() Dim num As Integer Dim sum As Integer = 0 Console.Write(&quot;Enter a number: &quot;) num = Convert.ToInt32(Console.ReadLine()) Dim temp As Integer = num Dim digits As Integer = num.ToString().Length While temp &gt; 0 Dim digit As Integer = temp Mod 10 sum += Math.Pow(digit, digits) temp \= 10 End While If sum = num Then Console.WriteLine(num &amp; &quot; is an Armstrong number.&quot;) Else Console.WriteLine(num &amp; &quot; is not an Armstrong number.&quot;) End If End Sub End Module This program takes a number as input, calculates the sum of its digits raised to the power of the number of digits, and checks if the sum equals the original number.


What is lattice division?

Lattice division is a visual method used to divide multi-digit numbers. It involves drawing a lattice or grid with diagonal lines to separate digits into different columns, then performing the division operation for each group of digits. This method helps students keep track of their place values and carries during the division process.


What has the author John Smiley written?

John Smiley has written: 'Learn to Program Databases With Visual Basic (Learn to Program)' 'Learn to Program Visual Basic Objects (Learn to Program)' 'Learn to Program with Visual Basic 6' -- subject(s): BASIC (Computer program language), Microsoft Visual BASIC, Visual Basic (Computer program), Visual programming (Computer science), Windows (Computer programs) 'Learn to Program Visual Basic 6 Examples' 'Introduction to Programming with Visual Basic 6 Part 2' 'Learn to Program Visual Basic Examples (Miscellaneous)' -- subject(s): Microsoft Visual Basic for Windows, BASIC (Computer program language)


How do you calculate sum of digit of a given three digit number in visual basic?

simple program


What is he photo of the grid of division?

The photo of the grid of division typically illustrates how a larger number can be divided into smaller, equal parts, often using a visual representation like a grid or array. This method helps in understanding division concepts, such as factors and multiples, by showing how many times a number can fit into another. It is commonly used in educational settings to aid students in grasping the fundamentals of division through a visual and interactive approach.


Program to print all the even numbers of an array in visual basic?

find even number in array


How do you create a program in visual basic?

arrays programms in visual basic


Does the visual boy advance give you viruses?

No, the Visual Boy Advance program does not give you viruses. You can get a virus from files downloaded from unsafe sources and then used with the Visual Boy Advance program.


What are two visual cues that tell you that WordPad is the active program?

switch to wordpad .what are two visual cues that tell you that wordpad is the ac8t7ive program?


Vb is extension of?

A Visual Basic program.


Who is the inventor of visual basic program?

microsoft


What are the different program structure of visual basic?

Program in visual basic are the component being used by the programer that will give the user fast and easy way.