ASDV-Java/Semester 1/Exams/Exam2_CalebFontenot/Problem2.html

50 lines
2.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Problem2.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #000000; background-color: #ffffff; font-family: Monospaced}
pre {color: #000000; background-color: #ffffff; font-family: Monospaced}
table {color: #000000; background-color: #e9e8e2; font-family: Monospaced}
.ST0 {font-family: Monospaced; font-weight: bold}
.ST1 {font-family: Monospaced; font-weight: bold; font-style: italic}
.ST2 {color: #009900; font-family: Monospaced; font-style: italic}
.literal {color: #0000e6}
.string {color: #ce7b00}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">C:\Users\ar114\Documents\NetBeansProjects\Exam2_CalebFontenot\src\exam2_calebfontenot\Problem2.java</td></tr></table>
<pre>
<span class="literal">package</span> exam2_calebfontenot;
<span class="literal">public</span> <span class="literal">class</span> <span class="ST0">Problem2</span> {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST1">main</span>(String[] args) {
<span class="literal">int</span> i = 1;
<span class="literal">do</span> {
<span class="literal">int</span> j = i;
<span class="literal">while</span> (j &gt; 1) {
System.<span class="ST2">out</span>.print(<span class="string">&quot;</span> <span class="string">&quot;</span>);
j--;
}
j = 1;
<span class="literal">while</span> (j &lt;= 6 + 1 - i) {
j++;
<span class="literal">if</span> (i % 2 == 0) {
<span class="literal">continue</span>;
}
System.<span class="ST2">out</span>.print((j - 1) + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
System.<span class="ST2">out</span>.println();
i++;
} <span class="literal">while</span> ( i &lt;= 6);
}
}
</pre></body>
</html>