Preview

Creating Programs on Visual Basic

Good Essays
Open Document
Open Document
1323 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Creating Programs on Visual Basic
BASIC INPUT/OUTPUT: 1. Create programs and write the algorithms of the given problems:
Write a program that computes the product of two numbers:
ALGORITHM:
ENTER two numbers
Compute the product of P=N1*N2
PRINT P
PROGRAM:
Program Product;
Uses crt;
Var N1,N2:integer;
Product:integer;
Begin
Clrscr;
Writeln(enter two numbers);
Readln(N1,N2);
Product:=N1*N2;
Writeln(The product:product);
Readln;
End.

2. Create a program that computes the difference of two numbers
ALGORITHM:
ENTER TWO NUMBERS
Compute the difference
PRINT D
PROGRAM:
Program difference;
Uses crt;
Var N1,N2: integer;
Difference : integer;
Begin
Clrscr;
Writeln(enter the two numbers);
Readln(D);
D:=N1-N2;
Writeln(‘the difference:difference’)
Readln;
End.

3. Write a program that computes the sum of two
ALGORITHM:
ENTER TWO NUMBERS
Compute the difference
PRINT D
PROGRAM:
Program difference;
Uses crt;
Var N1,N2: integer;
Difference : integer;
Begin
Clrscr;
Writeln(enter the two numbers);
Readln(D);
D:=N1-N2;
Writeln(‘the difference:difference’)
Readln;
End. 1.

SHORT IF THEN ELSE:

2. Create a program that determines If the input age is qualified to vote or not. Qualifying age is 18, If not (else), print” too young!”
Algorithm:
ENTER A
If A>=18 THEN
PRINT ”Qualified to VOTE”
ELSE
PRINT “TOO YOUNG”
PROGRAM:
Program vote;
Uses crt;
Var A:integer;
Begin
Clrscr;
Writeln(enter your age);
Readln(A);
If(A>=18)then
Writeln(qualified to vote)
Else
Writeln(too young);
Readln;
End.

3. Create a program that determines if the input numbers is a magic number (143) which is equivalent to the magic word: “I LOVE YOU”, if it is equivalent, then display the message.”Right” otherwise display the message. ”Wrong”.
Algorithm:
ENTER N
IF N=143 THEN
PRINT “I LOVE YOU”
ELSE
PRINT “WRONG”
PROGRAM:
Program MagicNumber;
Uses crt;
Var N:integer;
Begin
Clrscr;
Writeln(enter your Number);
Readln(N);

You May Also Find These Documents Helpful

  • Satisfactory Essays

    a1 script win213

    • 380 Words
    • 2 Pages

    If the user does not enter a numeric value the program should prompt for a numeric value…

    • 380 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    It210 Week 4 Psuedocode

    • 584 Words
    • 3 Pages

    = Yes || yes|| No || no Write: “That is not a correct entry!” Write: “Please enter Yes or No.” Input QuitNow…

    • 584 Words
    • 3 Pages
    Good Essays
  • Good Essays

    ElizabethFlaimFP

    • 1289 Words
    • 7 Pages

    Problem Definition: Design a program that allows a user to input a list of family members, along with their age and the state where they live. The program will determine and print the average age of the user’s family. The program will also print the names of any family member that lives in Texas. The program design should also allow the user to enter at least 50 family members.…

    • 1289 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    CEIS100 W5 ILab Report

    • 320 Words
    • 2 Pages

    The objective was to create a program using python. The program should successfully ask the user to input his or her name. Then ask the user to enter his or her age. If they are older than 16 then they can drive a car. Display this message along with their name. Then end the program by stating the users name, and that it is nice to meet them.…

    • 320 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    2.Write a program to (a) display a “?” (b) read two decimal digits whose sum less than 10 (c) display them and their sum on the next line. Page: 80…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    Program Lovecs.Java

    • 422 Words
    • 2 Pages

    import java.util. Scanner; public class LoveCS { public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("Enter how many times you wish the message to be printed."); int limit = 0; limit= scan.nextInt(); int sum=0; int count=1; while (count <=limit) { System.out.println(count+" I love Computer Science!!"); sum+=count; count++; } System.out.println("Printed this message " + limit + " times."); System.out.println("The sum of the numbers from 1 to "+limit+" is "+sum); } } import java.util. Scanner; public class PowersOf2 { public static void main(String[]args) { int valuePowersOf2; int nextPowersOf2 =1; int exponent= 0; int count=0; Scanner scan = new Scanner(System.in); System.out.println("Enter A Number.");…

    • 422 Words
    • 2 Pages
    Better Essays
  • Good Essays

    Programing Problems

    • 721 Words
    • 3 Pages

    IT 210 13 Programming Problems Pseudocode for chapter 2 checkpoint Frank T. Hartman IT 210 13 Programming Problems Pseudocode for chapter 2 checkpoint Frank T. Hartman Programming Problem 1 Main Module Declare SalesAmount As Real Declare CommissionRate As Real Declare CommissionEarned…

    • 721 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    1. Problem definition: Design a program that will allow a user to Input a list of your family members along with their age and state where they reside. Determine and print the average age of your family and print the names of anyone who live in Texas.…

    • 467 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    code program

    • 317 Words
    • 2 Pages

    (Compilation screenshot) - Insert here a screenshot of the result of compiling the above source code: NetBeans IDE 7.3.1 compiles but it did not go to the screen so I could see it, this is why I sent you a message yesterday to let you know this. But the program did run without any problems.…

    • 317 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    At what age should teens be allowed to vote? Some argue that the voting age should be lowered to 16 years old, while others believe that it should remain the same. 16 years olds lack the responsibility needed to vote. 16 year olds are scientifically proven to be underdeveloped and not fully mature. 16 year olds are frequently liberal until they grow up to have adult responsibilities.…

    • 454 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Some countries including Taiwan and Japan do not allow young people the right to vote until they are 21. But in countries the voting age is younger. For example in Korea, Sudan and Indonesia it is 17, in Brazil, Cuba and Nicaragua it is 16, and in Iran it is as low as 15.In other democracies such as the UK, USA and Australia there are growing movements to lower the voting age to 16. The reasons the age should be are reduced can be broken down in to five main points.…

    • 747 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    Young Voter Turnout Essay

    • 1101 Words
    • 5 Pages

    Determining who is voting each election day, proves a difficult task because the Federal Election Commission does not have a way of knowing voter’s ages as they cast their ballot (Levine and Lopez, 2002). This is because voters are not required to state their age when they vote, and so all of the information is based upon surveys taken after the fact (Eisner, 2004). By adding people’s ages to the ballot, we can accurately determine how severe the problem…

    • 1101 Words
    • 5 Pages
    Better Essays
  • Good Essays

    · The user enters values for the length and width of a rectangle and clicks the Calculate button or presses the Enter key to activate that button.…

    • 305 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    The name game takes a string as input (your name) and searches through it for various tidbits of information. It can tell you your first name and last name and how many characters your name have.…

    • 1102 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Programming Mini Project

    • 1010 Words
    • 5 Pages

    SOFTWare design FLOWCHART Start define SIZE 52 int getInput1(void); int getBalance(void); int dispData(void); int countAge(void); void getName(char first_name[10]); void getName2(char last_name[10]); int main(void) Declare num,ic, first_name[10],last_name[10], soal,i Print WELCOME TO Intelligence Tech ptd.ltd Main Menu:-) This smart card reader provides you some applications.…

    • 1010 Words
    • 5 Pages
    Satisfactory Essays