2
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by eggi
0

Hey there,

Did you want to do some calculation against the constant or just determine if a number is avogadro's number or not? If so, all you have to do is test whether or not the number equals the number (6.022 x 10 to the 23rd power).

I'm probably missing something. If you could explain further, maybe I can help.

Best wishes,

Mike

0

Hey There,

Here's one way to do it:

#!/bin/bash

echo -n "Enter your number: "
read answer

if [ "$answer" == "6022000000000000000000000" ]
then
echo "You picked the Avogadro Number! $answer"
else
echo "That number isn't the Avogadro Number!"
fi

Output:

$ ./av.sh
Enter your number: 3120280138
That number isn't the Avogadro Number!

$ ./av.sh
Enter your number: 6022000000000000000000000
You picked the Avogadro Number! 6022000000000000000000000

Hope that helps :)

, Mike

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.