60 658
Assignments Done
97,7%
Successfully Done
In April 2018

Answer to Question #3130 in AJAX | JavaScript | HTML | PHP for Avijit Roy Kabyo)

Question #3130
Write a program to read the following numbers, round them off to the nearest integers and print out the
results in integer form:
29.55 50.32 101.97 -35.45 -219.62
Expert's answer
<script type="text/javascript">
var n=window.prompt("Enter the number of elements, n","");
var a=new Array(n);
for (i=0; i<n; i++)
{
& a[i]=window.prompt("Enter a["+i+"]","");
};
for (i=0;i<n;i++)
{
document.write(Math.round(a[i]) + "<br />");&
};
</script>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions