473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how can I create Infinite number....

Hello everyone

please help me to Write a complete program USING EITHER FOR LOOP OR A WHILE LOOP that will display the first n numbers of the following infinite sequence:
1 , 3 , 6 , 10 , 15 , 21 , 28 , 36 , 45 , . . .
The program is to be written such that the user will enter a positive integer n , representing the number of elements of the sequence that the user wants displayed, and then these n sequence numbers are displayed in a vertical, column format.

Thank you
Deven Oza
Dec 10 '06 #1
1 2399
Hello everyone

please help me to Write a complete program USING EITHER FOR LOOP OR A WHILE LOOP that will display the first n numbers of the following infinite sequence:
1 , 3 , 6 , 10 , 15 , 21 , 28 , 36 , 45 , . . .
The program is to be written such that the user will enter a positive integer n , representing the number of elements of the sequence that the user wants displayed, and then these n sequence numbers are displayed in a vertical, column format.

Thank you
Deven Oza
-------------------------------------------------------------------------------------------------------------------
Here is the program :

declare
n number(10) := &num_elements;
temp number(10) := 0;
begin
for i in 1..n loop
temp := i+temp;
dbms_output.put_line(temp);
end loop;
end;

Hope this will help !!
Jan 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

43
by: Gremlin | last post by:
If you are not familiar with the halting problem, I will not go into it in detail but it states that it is impossible to write a program that can tell if a loop is infinite or not. This is a...
37
by: Protoman | last post by:
Hi!!! Protoman here, I need to write an infinite precision number class b/c I want to compute pi. Give me some sample code. Also, when I run my program and it computes pi, will my computer freeze...
6
by: Rudolf Bargholz | last post by:
Hi , I have the following tables ------------- PAX: Id Order_Id Name Position
1
by: Jim P. | last post by:
I'm having trouble returning an object from an AsyncCallback called inside a threaded infinite loop. I'm working on a Peer2Peer app that uses an AsyncCallback to rerieve the data from the remote...
8
by: Joe Abou Jaoude | last post by:
hi, I have a web app with forms authentication and a timeout session of 20 mins for security reasons. I recently added a feature that allows users (if they want to) to automatically log in...
59
by: rami | last post by:
please everybody ,can anyone tell me how to do an infinite loop in C
4
by: Michael Goerz | last post by:
Hi, why does the following result in an infinite loop when the user does *not* enter a number? do{ printf("Enter Number: "); } while ( ! scanf("%i", &input) );
4
by: mohammadthalif | last post by:
Hello guys, i want to pass infinite number of arguments to a function and print all of them how can i do it in c. example: main(void) { foo(1,2,3,"welcome","hi","how are you"); ...
10
by: bhipwell via AccessMonster.com | last post by:
Hello, I am stuck on this one. To illustrate my point, I will use cars as my example. I have a text field for which users can enter in anything they want. This particular field holds the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.