Computer Science, asked by Rohitjason, 1 year ago

write a menu driven program Armstrong number. ​

Answers

Answered by prabin100
2

Refers to programs whose user interface employs menus. The antithesis of a menu-driven program is a command-driven program.

on Java

<HTML>

<HEAD>

<TITLE>MenuDriven</TITLE>

</HEAD>

<BODY>

<H1> Menu Driven Program For Armstrong and sum of digits</H1>

<p>

<SCRIPT>

var i,j,r,ch;

var n;

var sum=0;

ch=parseInt(prompt(“Enter 1 for Armstrong number and 2 for sum of digits”));

switch(ch)

{

case 1:

document.write(“Armstrong Number :- “);

for(i=1;i<=1000;i++)

{

j=i;

sum=0;

while(j>0)

{

r=j%10;

sum=sum+(r*r*r);

j=parseInt(j/10);

}

if( sum==i)

{

document.write(sum+” , “);

}

}

break;

case 2:

n=parseInt(prompt(“Enter any number for finding sum of digits”));

while(n>0)

{

sum=sum+n%10;

n=parseInt(n/10);

}

document.write(“<br>”+”Sumgits= “+sum);

break;

default :

alert(“Wrong choice”);

}

</SCRIPT>

</BODY>

<HTML>

mark as brainliest please


prabin100: mark as brainliest please
vishali51: oh ji jaroor
Answered by vishali51
0

...........hteuyrttuuud7gd

Similar questions
Music, 7 months ago