#include<iostream>
// forward declarations...
unsigned reverse (unsigned, const unsigned base = 10);
bool is_palindrome (const unsigned);
// the program...
int main (void) {
const unsigned max {500};
const unsigned min {100};
std::cout << "Palindromes from " << max << " to " << min << std::endl;
for (unsigned num {max}; num>=min; --num) {
if (is_palindrome (num)) {
std::cout << num << std::endl;
}
}
}
// Returns the reverse of a number using the given base (default: base 10)
// Note: trailing zeroes do not become leading zeroes so reverse (100) returns 1 not 001.
// However, the reverse of 0 is obviously 0.
unsigned reverse (unsigned num, const unsigned base /* = 10 */) {
unsigned rev {}; // zero-initialised
while (num) {
rev *= base;
rev += num % base;
num /= base;
}
return rev;
}
// If the reverse of a number is the same number, that number is a palindrome.
// All single-digit numbers are palindromes, including 0.
bool is_palindrome (const unsigned num) {
return num == reverse (num) ;
}
Sure! Here's a Java program that will print all the nested loops between 1 to 500: public class NestedLoopExample { public static void main(String[] args) { for (int i = 1; i <= 500; i++) { for (int j = 1; j <= 500; j++) { System.out.println("i=" + i + ", j=" + j); } } } } This program uses two nested for loops to iterate from 1 to 500. It prints the value of i and j for each iteration of the loops.
It is 100+j(500-300) ohm = (100+j200) ohm = 223.6<630 ohm
import java.math.*; import java.util.*; class AutomorphicNumber{ static int d=10; public static void main(String args[]){ System.out.print("Enter any number :"); Scanner input=new Scanner(System.in); int n=input.nextInt(); if(d>=n){ if ((n*n) % d == n){ System.out.println("Automorphic Number"); } else{ System.out.println("Not Automorphic Number"); } } else if(d<=n){ d=d*10; if ((n*n) %d==n){ System.out.println("Automorphic Number"); } else{ System.out.println("not an automorphic number"); } } } }
C=100, V=5, D=500
well you could go with something like this (this code gives you all triples within a < 500 and b < 500): --------------------------------------------- for (int i = 0; i < 500; i++) for (int j = 0; j < 500; j++) { double squareroot = Math.Sqrt(i*i + j*j); if (squareroot == Math.Round(squareroot)) { // i, j and squareroot is your triple. Add them to list or what ever. } }
500 2500.
100 times because if you do the opposite with the numbers you have, 500/5=100
500
40. There are 400 numbers between 100 and 500 and one in every ten ends in 5.
Well First, you need 500 because 500/5 is obviuosly 100. 98+99+100+101+102= 500. Therefore, the consecutive whole numbers are 98,99,100,101,102! -Levizy123
100 + 300 + 500 + 500 + 600 = 2000. Then divide by 5 to get 400. The mean of these five numbers is 400.
The 3 digit numbers under 500 are 100 through 499.
500
Racecar
500
There are (500-100)/2 = 200 numbers divisible by 2 between 100 and 500 counting 100 but not 500. Of these (500-100)/8 = 50 are divisible by 8. So there are 150 numbers between 100 and 500 divisible by two but not by 8. By relative primeness exactly 50 out of these 150 are divisible by 3 and therefore these 50 are exactly the ones divisible by 6 but not by 8.
Multiply them by 100 - as you would with even numbers. So 5, as a percentage is 5*100 = 500%