Assignment 01 Visual Programming Elementary Furqan hassan
Assignment 01 Visual Programming Elementary Furqan hassan
Visual Programming
Name: Furqan
Hassan Seat-No:
19122006
Subject: visual programming
Depart: Computer science
Date: 03-march-2023
Q no1. Write a program that prints ‘Hello World’ to the screen.
Q no2. Write a program that asks the user for their name
and greets them with their name.
Qno3 Modify the previous program such that only the users Alice and Bob
are greeted with their names.
Qno 4 Write a program that asks the user for a number n and prints the sum
of the numbers 1 to n
Qno 5 Modify the previous program such that only multiples of three or five
are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17
Qno 6 Write a program that asks the user for a number n and gives them the
possibility to choose between computing the sum and computing the
product of 1,...,n.
Q7 Write a program that prints a multiplication table for numbers up to 12.
Qno 8 Write a program that prints all prime numbers. (Note: if your programming
language does not support arbitrary size numbers, printing all primes up
to the largest number you can easily represent is fine too.)
Qno 9 Write a guessing game where the user has to guess a secret number.
After every guess the program tells the user whether their number was
too large or too small. At the end the number of tries needed should be
printed. It counts only as one try if they input the same number multiple
times consecutively.
Qno10 Write a program that prints the next 20 leap years.
Qno 11 Write a function that returns the largest element in a list
Qno 12 Write function that reverses a list, preferably in place.
Qno 13 Write
a function
that checks
whether an
element
occurs in a
list.
Qno 14 Write a function that returns the elements on odd positions in a list
Qno 16 Write
a function
that tests
whether a
string is a
palindrome.
Q n o 17 Write three functions that compute the sum of the numbers in a list: using
a for-loop, a while-loop and recursion. (Subject to availability of these
constructs in your language of choice.)
I will do this in javascript: