Enter values and end of the list enter -1 to see output. but execute it at command line.
<?php
function readData(){
fwrite(STDOUT, "Please enter your name\n");
// Read the input
$name = fgets(STDIN);
if($name != -1)
readData();
fwrite(STDOUT, "Hello $name");
return;
}
readData();
?>
start
num Sub
num Size = 10
index = 0
while index<10
index = index + 1
endwhile
while index > 0
index = index - 1
endwhile
print Sub
stop
This is C++ Code:
#include <iostream>
using namespace std;
int main()
int x = 10;
for(int i = 0; i > 0; i++)
cout << x;
x = x - 1;
return 0;
-- this might be something easier to understand:
start
num Sub
num Size = 10
index = 0
while index<10
index = index + 1
endwhile
while index > 0
index = index - 1
endwhile
print Sub
stop
/n make by dibyendu/n
#include<stdio.h>
#include<conio.h>
main()
{
int j,n;
clrscr();
printf("Enter a number");
scanf("%d",&n);
for(j=n;j>=0;j--)
{
printf("%d\n",j);
}
getch();
}
First, create an array to hold the answers:
int answers [10] ;
int count = 0 ;
The count will contain the index into the number of answers given. Then, after all the values have been input, simply count backward in a loop to give the reversed order of entering:
for (int x = count; x > 0; x--)
{
printf ("Value : %d\n", answers [x]) ;
}
That's it!
import java.util.*;
class reverse
{
public static void main(String args[])
{
System.out.println("Enter the elements ");
for(int i=0;i<10;i++)
int a[i]=sc.nextInt();
System.out.println("you entered the array is");
for(int i=0;i<10;i++)
System.out.println(a[i]);
System.out.println(" the reverse order array is");
for(i=9;i>=0;i--)
System.out.println(a[i]);
}
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<10;i++)
{
printf("%d\t",i);
}
for(j=10;j>=1;j--)
{
printf("%d\t",j);
}
getch();
}
Pseudo-code is an informal method of describing an algorithm in language, but the chosen language can be anything. Key to pseudo-code is to describe the algorithm unambiguously and intuitively, and free from knowledge or constrains of a particular human language or programming language.
As an example, an algorithm which counts down from 10 to 1 could be described like so:
for each whole number N, counting down from 10 to 1 in steps of 1:
print N next number N
The simplest solution is to use a stack
stack s
// input 10 numbers
for i = 1 to 10 inclusive
input n
s.push (n)
next i
// print numbers in reverse order
for i = 1 to 10 inclusive
print s.top()
s.pop()
next i
int i=10;
while (i>0) {
printf ("%d\n", i);
i--;
}
let n = 10
while n >= 1
{
print n
let n = n - 1
}
end while
Hand Tracing Page 63 Programming Logic and Design by Tony Gladdis
Logical errors are grammatical errors or mistakes made by a programmer in java, it may not affect the program design but it can change the context of the statements.
Snarled program logic is unstructured logic, also known as "spaghetti" logic. Compiled machine code is the ultimate example of snarled program logic. Although spaghetti code is more compact and efficient than structured code, it is extremely difficult to both comprehend and maintain. Hence we use structured programming languages to provide a high level of abstraction between the logic of the programmer and the snarled logic of the machine-dependant code.
Flowchart it is diagrammatic Program it is coding. A flowchart is drawn out on paper, and shows the logic of an if/then/else statement. The programming actually is the if/then/else, not just the logic.
first think of the logic and then write the statements
paper plaintext
program calculates
Reverse Logic - album - was created in 1981.
by the procedure design a half subtractor design a logic ciruit to add two numbers with five bits each drawthe logic diagram of afull adder using using NAND gates only ?
Flowchart pg 32 Programming Logic and Design by Tony Gaddis
Krome Barratt has written: 'Logic and design' -- subject(s): Design 'Logic and Design, Revised'
If you mean Logic as in Electronics, Computers etc... Then Electrical and Electronics Engineers study Logic design including True/False equations, AND/OR/NAND/NOR Gates. Logic design is essential for Electronic/Microprocessor and other electronic equipment design tasks. Entire computers of any complexity can be broken down to individual logic elements.
Most studies in logic: Boolean algebra, predicate logic etc are independent of numbers.
Program logic controllers are used to control the operation of most systems.
Frederic J. Mowle has written: 'A systematic approach to digital logic design' -- subject(s): Logic circuits, Logic design
Hand Tracing Page 63 Programming Logic and Design by Tony Gladdis
Arthur D. Friedman has written: 'Fundamentals of logic design and switching theory' -- subject(s): Logic circuits, Logic design, Switching theory