728x90 AdSpace

Latest Article



Loop Example Program Practice Question in C C++ VB and Java






Loop Example Question that can be use in Visual basic ,C ,C++ , java and C# any programming language.
Following question first try with Do While loop and then Do loop Until for better understanding loops.

  1. Write a program that requests an exam score in a text box and displays a letter grade with the scale 90-100 (A), 80-89 (B), 70-79 (C), 60-69 (D) and 0-59 (F) in a picture box.
  2. Write a program that Display 1 to 100 numbers.
  3. Write a program that Display 100 to 1 numbers.
                  100 99 98 …..2 1
  1. Write a program that Display sum and product of 1 to 100 numbers.
  2. Write a program that Display odd number between of 1 to 100 numbers.
  3. Write a program that Display sum and product of even number between of 1 to 100 numbers.
  4. Write a program that Read a number from user and display the table of that number.
            2 X 1=2
2 X 2=4
.  .  .  .  .
2 X 10=20
Here number is 2
  1. Request a number and display asterisks in the following format. The number you input should be equal to the number of stars in a line and the number of lines to be printed.
****
 ****
****
 ****
  1. Write a program to display all the numbers between 1 and “n” that are perfect squares. The value of “n” will be input by the user.
  2. Write a program that Read a number from user and display its factorial.
                    5!    1 X 2 X 3 X 4 X 5=120
  1. Write a program that Display the following Fibonacci series using loop.
                          0 1 1 2 3 5 8 13……
  1. Write a program that calculates following formula. User read values of n and m then calculate power using loop.
                n power m.
               2 power 3=8
  1. Write a program that display following output
A)                                     B)

* * * * *                                  *
* * * * *                                  * *
* * * * *                                  * * *
* * * * *                                  * * * *
* * * * *                                  * * * * *

no image






  • Blogger Comments
  • Facebook Comments

3 comments:

  1. What are loops and how we can use them?

    In general a loop is a sequence of statements which is specified once but which may be carried out several times in succession. The function of the loop is to repeat the calculation a given number of times until it reaches a certain value. The code inside the loop is obeyed a specified number of times, or once for each of a collection of items, or until some condition is met, or indefinitely. We can divide loops into:
    1) Count-controlled loops,
    2) Condition – controlled loops,
    3) Collection - controlled loops,
    4) General iteration,
    5) Infinite loops,
    6) Continuation with the next iteration,
    7) Redo the current interation and
    8) Restart loop

    For more information please visit: http://megacplusplustutorials.blogspot.com

    ReplyDelete
  2. Dear Sir, where are the solutions of these questions????????

    ReplyDelete
  3. All things considered Yea Flash player has been popular to the point that it may have required a decent reminder and it would appear that it got it and the vitality is straightforward of why glimmer is so incredible getting your message to however many clients as could be expected under the circumstances in the most drew in way imaginable that would take a shot at any gadget that blaze has its impression on... Java

    ReplyDelete