write a vbscript for finding the sum of the numbers from 1-
50

Answers were Sorted based on User's Feedback



write a vbscript for finding the sum of the numbers from 1- 50..

Answer / jethva_trupti

<html>
<body>

<script type="text/vbscript">
dim n,i,sum
sum=0
i=1
n=5
do while (i<=n)
sum=sum+i
i=i+1
loop
document.write(sum)
</script>

</body>
</html>

Is This Answer Correct ?    60 Yes 15 No

write a vbscript for finding the sum of the numbers from 1- 50..

Answer / ankita

dim i ,n ,sum as integer
n=50
sum=0
for i=1 to n
sum=sum+i

msgbox("sum of 1 o 50 no. =" +sum)
next

Is This Answer Correct ?    19 Yes 7 No

write a vbscript for finding the sum of the numbers from 1- 50..

Answer / kishore

dim n
n=inputbox("enter a number")
k=(n*(n+1))/2
msgbox k

Is This Answer Correct ?    10 Yes 13 No

Post New Answer

More VB Script Interview Questions

What is wrong with the following code: <%afname="header.asp"%><!?#include file ="<%=afname%>"?>

1 Answers  


Anyone have qtp11.0 crack?

0 Answers  


Give examples where vb script can directly run on users system with windows as os?

1 Answers  


What is the use of the formatdatetime function in the vbscript language?

0 Answers  


1. How to handle object implementation change in DP for Ex: i have login page with username,pasword (editboxes),login,cancel(buttons). Here i written DP code for login page with the help properties. My questions: 1.If properites are changing dynamically i will do (i want code for that) 2.if objects are changed dynamcally i will do (i wnat code for that)

0 Answers   iFlex,


Mention how you can call vbscript functions?

0 Answers  


wat is com(common object model)object for mozilla firefox??? if any knows the exact answer....plz rply me

2 Answers  


when you use For Loop, While..do, do..while? at what situations which loop will use.

1 Answers  


input values to accept 2 numbers & print the product, difference and sum using switch case

1 Answers   CSC,


how to automatically update the sql server2005 database records when insert in vb6?

0 Answers  


How will you convert a given number to long in vbscript?

0 Answers  


How to open excel in vb script?

0 Answers  


Categories