From 0cf9d62430b0daf52a3c6ee165f2ad464b353b8c Mon Sep 17 00:00:00 2001 From: Siddhant-2312 <57628265+Siddhant-2312@users.noreply.github.com> Date: Sun, 24 Nov 2019 00:24:14 +0530 Subject: [PATCH] Add files via upload --- Ide (1).py | 30 ++++++++++++++++++++++ Ide (5).c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Ide.py | 13 ++++++++++ 3 files changed, 116 insertions(+) create mode 100644 Ide (1).py create mode 100644 Ide (5).c create mode 100644 Ide.py diff --git a/Ide (1).py b/Ide (1).py new file mode 100644 index 0000000..93d490e --- /dev/null +++ b/Ide (1).py @@ -0,0 +1,30 @@ + +MAX = 1000 + + fibonacci code: +f = [0] * MAX + +def fib(n) : + # Base cases + if (n == 0) : + return 0 + if (n == 1 or n == 2) : + f[n] = 1 + return (f[n]) + + if (f[n]) : + return f[n] + + if( n & 1) : + k = (n + 1) // 2 + else : + k = n // 2 + if((n & 1) ) : + f[n] = (fib(k) * fib(k) + fib(k-1) * fib(k-1)) + else : + f[n] = (2*fib(k-1) + fib(k))*fib(k) + + return f[n] + +n = int(input()) +print(fib(n)) \ No newline at end of file diff --git a/Ide (5).c b/Ide (5).c new file mode 100644 index 0000000..e43aff3 --- /dev/null +++ b/Ide (5).c @@ -0,0 +1,73 @@ + + +#include + +void main() { + int i,j,sum=0,n,k=0,s=17,q,r,x; + + n=10; + scanf("%d",&x); + q=2*x; + if(x==4){ + s=17; +for (i=1;i<=x;i++){ + for (j=1;j<=x;j++){ + if(j>=i){ + sum=sum+n; + printf("%d",sum);} + else if(i>j){ + printf("**");} + else{ + printf(" ");} + } + for (r=x+1;r<=q;r++){ + + if(q==(r)){ + printf("%d",(s+(r-(x)))-1); + } + + else{ + printf("%d0",(s+(r-(x)))-1);} + + + + } +k++; +s=s-((q-x)-1); +q=q-1; + printf("\n"); + } + } + else + { + s=26; + for (i=1;i<=x;i++){ + for (j=1;j<=x;j++){ + if(j>=i){ + sum=sum+n; + printf("%d",sum);} + else if(i>j){ + printf("**");} + else{ + printf(" ");} + } + for (r=x+1;r<=q;r++){ + + if(q==(r)){ + printf("%d",(s+(r-(x)))-1); + } + + else{ + printf("%d0",(s+(r-(x)))-1);} + + + + } +k++; +s=s-((q-x)-1); +q=q-1; + printf("\n"); + } + } +} + \ No newline at end of file diff --git a/Ide.py b/Ide.py new file mode 100644 index 0000000..f5d472f --- /dev/null +++ b/Ide.py @@ -0,0 +1,13 @@ +# cook your dish here +import string + +alpha = string.ascii_lowercase + +num = int(input()) + +def srange(N): + return list(range(N))+list(range(N-2,-1,-1)) + +for i in srange(num): + print('-'.join([alpha[num-j-1] for j in srange(i+1)]).center(4*(num-1)+1,'-')) + \ No newline at end of file