Re: [Dev-C++] Dev-cpp-users Digest, Vol 35, Issue 2
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Franco B. <fbr...@gm...> - 2009-04-03 13:44:20
|
Fibonacci
For each of two posted cases, try the C code below:
/* code begin */
#include <stdio.h>
#include <conio.h>
int main()
{
const int
FIBO_SIZE = 100;
double
a = 0,
b = 1,
c,
fibonacci[FIBO_SIZE];
int
d,
i;
printf("\n\n First case\n");
/* first case */
while (b < 10)
{
printf("%3.0f\n", b);
c = a + b;
a = b;
b = c;
}
printf("\n\n Press a key to run Second case");
getch();
printf("\n Second case\n");
/* returning to initial values, to the second answer */
a = 0;
b = 1;
for (i = 0; i < FIBO_SIZE - 1; ++i)
{
c = a + b;
a = b;
b = c;
d = i + 1;
*(fibonacci + i) = a;
*(fibonacci + d) = b;
printf("%3d %25.0f\n", i, *(fibonacci + i));
}
printf("%3d %25.0f\n\n\n Press a key to exit ", d, *(fibonacci + d));
getch();
return 0;
}
/* code end */
I hope it helps.
Franco
2009/4/3 <dev...@li...>
> Send Dev-cpp-users mailing list submissions to
> dev...@li...
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> or, via email, send a message with subject or body 'help' to
> dev...@li...
>
> You can reach the person managing the list at
> dev...@li...
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Dev-cpp-users digest..."
>
> Today's Topics:
>
> 1. Re: Dev-cpp-users Digest, Vol 35, Issue 1 (edison ibanda)
> 2. Re: Dev-cpp-users Digest, Vol 35, Issue 1 (Per Westermark)
> 3. Re: Dev-cpp-users Digest, Vol 35, Issue 1 (rodolfo d'Ettorre)
>
>
> ---------- Mensagem encaminhada ----------
> From: edison ibanda <edi...@gm...>
> To: dev...@li...
> Date: Fri, 3 Apr 2009 08:41:16 +0300
> Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 35, Issue 1
> Hi over there,
> Can someone over there help me write a program to display a series of 100
> fibonachi numbers in an array.With each number against its index?
> Will be greartful for your help.
> Edison.
>
> On Thu, Apr 2, 2009 at 3:04 PM, <
> dev...@li...> wrote:
>
>> Send Dev-cpp-users mailing list submissions to
>> dev...@li...
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>> or, via email, send a message with subject or body 'help' to
>> dev...@li...
>>
>> You can reach the person managing the list at
>> dev...@li...
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Dev-cpp-users digest..."
>>
>>
>> Today's Topics:
>>
>> 1. Re: dev-c++ & postgresql 8.3.7 (Windows XP) (Reid Thompson)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Wed, 01 Apr 2009 22:47:29 -0400
>> From: Reid Thompson <rei...@at...>
>> Subject: Re: [Dev-C++] dev-c++ & postgresql 8.3.7 (Windows XP)
>> To: Osvaldo Demierre <osv...@ya...>
>> Cc: dev...@li...
>> Message-ID: <49D...@at...>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Osvaldo Demierre wrote:
>> > Hello.
>> > I work on Windows XP and I am trying run a program "c" compiled under
>> > DEP-C++ 4.9.9.2, to access POSTGRESQL 8.3.7.
>> > The program is compiled/linked OK, but don't work.
>> > Anyone can help me? (the source is below...)
>> > Thank in advance...
>> >
>> what error are you getting.
>>
>>
>>
>> ------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> Dev-cpp-users mailing list
>> Dev...@li...
>> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>
>>
>> End of Dev-cpp-users Digest, Vol 35, Issue 1
>> ********************************************
>>
>
>
>
> ---------- Mensagem encaminhada ----------
> From: Per Westermark <pw...@ia...>
> To: edison ibanda <edi...@gm...>
> Date: Fri, 3 Apr 2009 10:12:53 +0200 (CEST)
> Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 35, Issue 1
> Would your school teacher also be grateful for our help?
>
> I would think that the code skills needed for this project would already
> have been covered during the classes. It is just a question of combining
> the building blocks into something meaningful.
>
> By the way - don't reply to the daily summary without first removing all
> the noise.
>
> /pwm
>
> On Fri, 3 Apr 2009, edison ibanda wrote:
>
> > Hi over there,
> > Can someone over there help me write a program to display a series of
> 100
> > fibonachi numbers in an array.With each number against its index?
> > Will be greartful for your help.
> > Edison.
>
>
>
>
>
>
> ---------- Mensagem encaminhada ----------
> From: rodolfo d'Ettorre <rod...@ho...>
> To: <pw...@ia...>, <edi...@gm...>
> Date: Fri, 3 Apr 2009 10:47:47 +0000
> Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 35, Issue 1
>
> Fibonacci?? I have got an example:
>
> ... a, b = 0, 1
>
> >>> while b < 10:
>
> ... print b
>
> ... a, b = b, a+b
>
>
> Ohhh, just one problem, it is in Python, but anybody can translate it in C.
>
> Enjoy
>
> Rodolfo d'Ettorre
>
>
> > Date: Fri, 3 Apr 2009 10:12:53 +0200
> > From: pw...@ia...
> > To: edi...@gm...
> > CC: dev...@li...
> > Subject: Re: [Dev-C++] Dev-cpp-users Digest, Vol 35, Issue 1
> >
> > Would your school teacher also be grateful for our help?
> >
> > I would think that the code skills needed for this project would already
> > have been covered during the classes. It is just a question of combining
> > the building blocks into something meaningful.
> >
> > By the way - don't reply to the daily summary without first removing all
> > the noise.
> >
> > /pwm
> >
> > On Fri, 3 Apr 2009, edison ibanda wrote:
> >
> >> Hi over there,
> >> Can someone over there help me write a program to display a series of
> 100
> >> fibonachi numbers in an array.With each number against its index?
> >> Will be greartful for your help.
> >> Edison.
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
> _________________________________________________________________
> Looking to change your car this year? Find car news, reviews and more
>
> http://a.ninemsn.com.au/b.aspx?URL=https%3A%2F%2F2.zoppoz.workers.dev%3A443%2Fhttp%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
|