plz tell me how to print

November 27, 2009 at 02:55:35
Specs: Windows XP
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

See More: plz tell me how to print

Report •


#1
November 27, 2009 at 03:47:52
#include <stdio.h>
int main() {
puts("1\n1 1\n1 2 1\n1 3 3 1\n1 4 6 4 1");
}

Now that answers it but won't get you any marks.


Report •

#2
November 28, 2009 at 04:40:36
A the number forms a ???? series. The next question will be
print the next line.

Report •

#3
November 29, 2009 at 11:48:19
just for fun, batch version fibonacci:

@echo off
setlocal enabledelayedexpansion
set /p nn=no. of lines:
set /a ff11=1
set /a ii=0
:Iloop
set out=
set /a aa="%ii%%%2"
set /a bb=1-aa
set /a jj=1
:Jloop
set /a ar=%jj%-1
if not defined ff%bb%%ar% set /a ff%bb%%ar%=0
if not defined ff%bb%%jj% set /a ff%bb%%jj%=0
set /a ff%aa%%jj%=!ff%bb%%ar%!+!ff%bb%%jj%!
set out=!out! !ff%aa%%jj%!
set /a jj+=1
if %jj% leq %ii% goto Jloop
if %ii% gtr 0 echo !out! >> test
set /a ii+=1
if %ii% lss %nn% goto Iloop
:ex


Report •

Related Solutions


Ask Question