مرحبا
هذا هوه السؤال وهذا الي عملته
انا عملت انه يعطيني خطا اذا كان الرقم زوجي ويكمل اذا كان مفرد بس ما يرضي يطلع الي النجوم
حد يساعدني ارجوكم
Write a script that prints the following diamond shape:
You may use output statements that print a single asterisk (*), a single space or a single newline
character. Maximize your use of repetition (with nested for statements), and minimize the number of
output statements.
Modify the program you wrote (part 1 of exercise 2) to read an odd number in the range 1 to 19.
This number specifies the number of rows in the diamond. Your program should then display a
diamond of the appropriate size.
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Exercise 2 Solution -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> Solution - Exercise 2 </title>
<script type = "text/javascript">
<!--
document.write( "<pre>" );
var i;
var j;
var midrow;
midrow=rowsnumber/2+1;
var rowsnumber; // number entered by the user
rowsnumber = window.prompt( "Please enter number of rows (odd number from1 to 19","0" );
rows =parseInt(rowsnumber);
if (rowsnumber%2==0)
{
alert("Number =,"+ rowsnumber +" Diamond Input Error");
}
من هنا بعدين علشين اطلع النجوم ما عرفت شو اعمل
document.write( "</pre>" );
// -->
</script>
</head><body></body>
</html>



اضافة رد مع اقتباس
المفضلات