BASIC
Chat with our AI personalities
10 cls 20 end 30 next 40 print
You'll need 3 variables for this, here's a pseudo code for swapping values of 2 variables.ALGORITHM SWAPvar1 = 10var2 = 20temp = 0temp = var1 "temp = 10"var1 = var2 "var1 = 20, originally 10"var2 = temp "var2 = 10, originally 20"END SWAP
if (length>=10 && length<=20) { // length is between 10 and 20, inclusive... }
10 for t = 1 to 50 20 input a 30 c = c + a 40 next t 50 print c
import java.io.*; public class sum{ public static void main(String[] args) { try{ System.out.print("Enter 10 numbers: "); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int[] input=new int[10]; int a,total=0; for(a=0;a<10;a++) { System.out.println(); input[a]=Integer.parseInt(br.readLine()); } for(a=0;a<10;a++) { total+=input[a]; } System.out.println("The sum of the numbers is "+total); }catch(Exception e) { e.printStackTrace(); } } }