user6819: Let's say we program an arduino uno or nano and then stop using it for a while. How long can we expect the program to last on the arduino? 

user16780: Practically forever. Rather make sure the contacts don't become too rusty.
( 83.7 % of Arduino problems are mechanical and contact issues :) ) 
Will your grandchildren still have a legacy USB cable and be interested in that thing and your c++ coding skills then?

user4143: More than 20 years, and probably more than 100 years.
That's the guaranteed minimum:

Data retention: 20 years at 85°C/100 years at 25°C(1)
(1)  Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over
  20 years at 85°C or 100 years at 25°C.


6819: <p>Let's say we program an arduino uno or nano and then stop using it for a while. How long can we expect the program to last on the arduino? </p>
 16780: <p>Practically forever. Rather make sure the contacts don't become too rusty.
( 83.7 % of Arduino problems are mechanical and contact issues :) ) </p>

<p>Will your grandchildren still have a legacy USB cable and be interested in that thing and your c++ coding skills then?</p>
 4143: <p>More than 20 years, and probably more than 100 years.</p>

<p>That's the guaranteed minimum:</p>

<blockquote>
  <p>Data retention: 20 years at 85°C/100 years at 25°C<sup>(1)</sup></p>
  
  <p><sub>(1)  Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over
  20 years at 85°C or 100 years at 25°C.</sub></p>
</blockquote>
