Use loop invariant to prove the working of the program, Programming Languages

1.  Use mathematical induction to prove

281_Use loop invariant to prove the working of the program.png

Whenever n is a positive integer.

2.  Use loop invariant to prove that the program for computing the sum of 1,...,n is correct.

INPUT: Integer n

OUTPUT: The sum of 1,...,n  

S(n)

1.  i ← 0

2.  while n>0

3.     do   i  ← i + n

4. n  ← n-1

5.  return(i)

Posted Date: 3/22/2013 3:21:47 AM | Location : United States







Related Discussions:- Use loop invariant to prove the working of the program, Assignment Help, Ask Question on Use loop invariant to prove the working of the program, Get Answer, Expert's Help, Use loop invariant to prove the working of the program Discussions

Write discussion on Use loop invariant to prove the working of the program
Your posts are moderated
Related Questions
Advantages of asp.net mvc framework MVC is a conventional style design that many designers are acquainted with. Some kinds of Web programs will advantage from the MVC structur

n2=2:100; t=3; while t { g3(t)=(1/2)*(0.63)*(0.8.^(n2)); t=t+1; } g3(1)=0; g3(2)=0; what is wrong with the code above? it tells me that line: g3(t)=(1/2)

What is DOM? The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure an

What is "No_Data_Found" in Oracle?

Expertsmind brings you  unique  solution in java assignments Just in Time Compiler In processing, just-in-time system (JIT), also known as energetic interpretation, is a m

Write a detailed description on how you would go about planning information system for an organisation

write a program to find the output 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 2 1 1 2 1 1

Write a script called 'prob2.m' that asks the user if they wish to clear the variables in the workspace. If the user responds with the strings 'y' or 'yes' then the workspace shoul

hi, can you help me with testing java classes I have wrote using java and jsp and servlet in eclipse ? I want to use JUnit for testing

What are the main pros and cons of assembly programming language?