Private Sub Check_Click()
Dim d As Integer
Dim num As Integer
Dim s As Integer
Dim old As Integer
num = Val(Text1.Text)
old = num
s = 0
While num > 0
d = num Mod 10
s = s + (d * d * d)
num = num \ 10
Wend
If old = s Then
Label1.Caption = "Armstrong"
Else
Label1.Caption = "Not armstrong"
End If
End Sub
Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11
write a vb program to find the magic square
Write a program to find the grade obtained by the students of a class
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
/*Program to find whether given no. is Armstrong or not. Example : Input - 153 Output - 1^3 + 5^3 + 3^3 = 153, so it is Armstrong no. */ class Armstrong{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); int n = num; //use to check at last time int check=0,remainder; while(num > 0){ remainder = num % 10; check = check + (int)Math.pow(remainder,3); num = num / 10; } if(check == n) System.out.println(n+" is an Armstrong Number"); else System.out.println(n+" is not a Armstrong Number"); } }
k
no thanks
You can use the Math.sqrt() method.
Yes, do write, or if you're too lazy to your homework, use google.
Write your own prime number program and find out.
Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11
write a vb program to find the magic square
For first find an example program.
Write a program to find the grade obtained by the students of a class
Yes, do write. That's what you always have to do when you have got a homework-program.
Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.