<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394820</guid>
        <pubDate>Mon, 12 Oct 2009 14:19:30 +0000</pubDate>
        <title>Возведение в степень через цикл for</title>
        <link>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394820</link>
        <description><![CDATA[BIOSonar: Всем большое спасибо]]></description>
        <author>BIOSonar</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394787</guid>
        <pubDate>Mon, 12 Oct 2009 14:00:57 +0000</pubDate>
        <title>Возведение в степень через цикл for</title>
        <link>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394787</link>
        <description><![CDATA[BIOSonar: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284405&view=findpost&p=2394740'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Alex_ru &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T13:39:47+00:00">12.10.09, 13:39</time></span><div class='quote '><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">import java.util.*;</div><div class="code_line">public class fg {</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Scanner in = new Scanner (System.in);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double r,n,m;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;n = in.nextDouble(); //если есть такой метод :)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m = in.nextDouble(); //если есть такой метод :)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = Math.pow(m, n);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Результат &quot; + r);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script></div></div><br>
Да я сам бы так и сделал. Но сказали именно через for ? while do или do while делать]]></description>
        <author>BIOSonar</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394740</guid>
        <pubDate>Mon, 12 Oct 2009 13:39:47 +0000</pubDate>
        <title>Возведение в степень через цикл for</title>
        <link>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394740</link>
        <description><![CDATA[Alex_ru: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">import java.util.*;</div><div class="code_line">public class fg {</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Scanner in = new Scanner (System.in);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;double r,n,m;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;n = in.nextDouble(); //если есть такой метод :)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m = in.nextDouble(); //если есть такой метод :)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r = Math.pow(m, n);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Результат &quot; + r);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div></ol></div></div></div></div>]]></description>
        <author>Alex_ru</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394733</guid>
        <pubDate>Mon, 12 Oct 2009 13:37:23 +0000</pubDate>
        <title>Возведение в степень через цикл for</title>
        <link>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394733</link>
        <description><![CDATA[kopilov: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">import java.util.*;</div><div class="code_line">public class fg {</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Scanner in=new Scanner (System.in);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int r,n,m;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;n=in.nextInt();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m=in.nextInt();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (m&#60;0) {System.out.println(&quot;Не вводите отрицательные числа!&quot;);}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int r=1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int i=0; i&#60;m; ++i) //for (инициализация;условие;итератор) </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{r = r*n} //операторы</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Результат &quot;+r);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div></ol></div></div></div></div> <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-12T13:39:21+00:00">12.10.09, 13:39</time></span></span><br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284405&view=findpost&p=2394727'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Alex_ru &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T13:35:11+00:00">12.10.09, 13:35</time></span><div class='quote '>Для подсчета степени используйте статический метод:<br>
Math.pow(m, n);</div></div><br>
Это, конечно, верно -- когда потренируетесь.]]></description>
        <author>kopilov</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394727</guid>
        <pubDate>Mon, 12 Oct 2009 13:35:11 +0000</pubDate>
        <title>Возведение в степень через цикл for</title>
        <link>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394727</link>
        <description><![CDATA[Alex_ru: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">for (int i = 0; i &#60; n; i++){</div><div class="code_line">...</div><div class="code_line">}</div></ol></div></div></div></div><br>
, где n - показатель степени, а i - количество итераций.<br>
<br>
r, m, n - надо перевести в тип double, дабы корректно работать с отрицательным показателем степени.<br>
Для подсчета степени используйте статический метод: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">r = Math.pow(m, n);</div></ol></div></div></div></div><br>
, где n - показатель степени, m - число возводимое в степень<br>
<br>
При использовании Math.pow никаких циклов for использовать не надо.]]></description>
        <author>Alex_ru</author>
        <category>Java</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394693</guid>
        <pubDate>Mon, 12 Oct 2009 13:22:57 +0000</pubDate>
        <title>Возведение в степень через цикл for</title>
        <link>https://forum.sources.ru/index.php?showtopic=284405&amp;view=findpost&amp;p=2394693</link>
        <description><![CDATA[BIOSonar: Здравствуйте. Задача- Написать программу - возведение числа n в m-ую степень. Входные данные поступают с клавиатуры. Результат выводится на экран. Предусмотреть обработку ошибок. <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">import java.util.*;</div><div class="code_line">public class fg {</div><div class="code_line">&nbsp;&nbsp; &nbsp;public static void main(String[] args) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Scanner in=new Scanner (System.in);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int r,n,m;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;n=in.nextInt();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m=in.nextInt();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (m&#60;0) {System.out.println(&quot;Не вводите отрицательные числа!&quot;);}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{for (r=?;r=?;?) //for (инициализация;условие;итератор) </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{????} //операторы</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;Результат &quot;+r);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}}}</div></ol></div></div></div></div><br>
Сама форма for известна только вот что именно в какой части писать? (после for)<br>
Напишите пожалуйста сам блок цикла.Не понимаю что за что лучше принимать.]]></description>
        <author>BIOSonar</author>
        <category>Java</category>
      </item>
	
      </channel>
      </rss>
	