#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
Here is a simple program to generate prime numbers upto a given specific number /*Prime No. from 1 to 50*/ /*By-Himanshu Rathee*/ #include<stdio.h> #include<conio.h> void main() { int i,j,n; clrscr(); printf(" Enter the number upto which we have to find the prime number: "); scanf("%d",&n); printf("\n"); for(i=2;i<=n;i++) { for(j=2;j<=i-1;j++) if(i%j==0) break; /*Number is divisble by some other number. So break out*/ if(i==j) printf("\t%d",i); /*Number was divisible by itself (that is, i was same as j)*/ } /*Continue loop upto nth number*/ getch(); }
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
500 2500.
100 times because if you do the opposite with the numbers you have, 500/5=100
Three numbers that equal 500 could be 200, 200, and 100. If you add these numbers together (200 + 200 + 100), the sum is 500. Alternatively, any combination of numbers that adds up to 500 would also work, such as 250, 250, and 0.
40. There are 400 numbers between 100 and 500 and one in every ten ends in 5.
500
Racecar
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
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.
500