In GE BASIC, you can print odd numbers using a FOR-NEXT
loop by specifying a starting point and incrementing by 2. Here’s a simple example:
FOR I = 1 TO 99 STEP 2
PRINT I
NEXT I
This will print all odd numbers from 1 to 99. The STEP 2
ensures the loop only increments by 2, thereby producing only odd numbers.
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
sdfdg
a triangle then a square :)
you need strings to print any character(your name) this is not possible useing array:D
In GW-BASIC, you can print even numbers from 1 to 100 using a simple loop. Here’s a sample code: FOR i = 1 TO 100 IF i MOD 2 = 0 THEN PRINT i NEXT i This program iterates through numbers 1 to 100 and prints each number if it is even (i.e., divisible by 2).
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program
For N = 1 to 10 Print 2 * N Next N
Use the option File / Print in the program you are using.
RANDOMIZE TIMER rndNumber% = INT(RND * 100) + 1 winFlag% = 0 CLS PRINT "PROGRAM: Guess the number" PRINT PRINT "I'm thinking of a number between: 1-100. You've 7 guesses..." PRINT PRINT "Guess No" FOR eachGuessNo% = 1 TO 7 PRINT eachGuessNo%; "> "; INPUT "What is my number"; guessNum% IF guessNum% = rndNumber% THEN PRINT "Yes, correct guess; you WIN!" winFlag% = 1 EXIT FOR END IF NEXT IF winFlag% = 0 THEN PRINT "No, you guessed WRONG! I the computer WIN!" PRINT "My number was: "; rndNumber% PRINT PRINT "Again, Y/N"; yesNo$ DO yesNo$ = INKEY$ LOOP UNTIL yesNo$ <> "" IF UCASE$(LEFT$(yesNo$, 1)) = "Y" THEN RUN END
Oh, what a lovely request! In FoxPro, you can create a program to print all prime numbers from 1 to 100 by using a loop to check each number for divisibility only by 1 and itself. If it meets this criteria, you can print it out on the screen. Remember, every number is unique and special, just like a happy little tree in a vast forest.
sdfdg
To write a BASIC program that checks if an input number is prime or composite, you can use a loop to test divisibility. First, prompt the user for a number and then check if it's less than 2 (which is neither prime nor composite). For numbers greater than 1, iterate from 2 to the square root of the number, checking if it divides evenly (using the modulus operator). If you find a divisor, the number is composite; otherwise, it's prime. Here's a simple example: INPUT "Enter a number: ", N IF N < 2 THEN PRINT "Neither prime nor composite": END IS_PRIME = TRUE FOR I = 2 TO SQR(N) IF N MOD I = 0 THEN IS_PRIME = FALSE EXIT FOR END IF NEXT I IF IS_PRIME THEN PRINT N; " is prime" ELSE PRINT N; " is composite"
a triangle then a square :)
You can use BASIC to write a program by leveraging its straightforward syntax and commands to perform tasks like input, output, and simple arithmetic operations. Start by defining your program with a clear structure, using commands like PRINT for output and INPUT for user interaction. Utilize loops and conditionals to control the flow of the program, and keep the code organized with comments for clarity. BASIC's simplicity makes it an excellent choice for beginners to grasp programming concepts effectively.
This program checks whether a number is odd or even. NOTE: This site removes formatting from answers. Replace (tab) with a tab or four spaces. #!/usr/bin/python print("Type a number.") n = input(": ") l = len(n)-1 even = ("02468") if n[l] in even: (tab)print(n, "is even.") if n[l] not in even: (tab)print(n, "is odd.")