Skip to main content

Posts

Showing posts from April, 2023

FUNCTIONS PROGRAM IN C

functions level1 nancy,simon,swathi #include <stdio.h> void getFibonacii(int a,int b,int n) {     int c;     if(n>0)     {         c=a+b;         a=b;         b=c;         printf("%d ",c);         getFibonacii(a,b,n-1);     } } int main() { int a=0,b=1,n; scanf("%d",&n); printf("%d %d ",0,1); getFibonacii(a,b,n-2); return 0; } Simon wants a number plate #include <stdio.h> #include<math.h> int isPerfectSquare(long long x){     int s=(int)sqrt(x);     return(s*s ==x); } int isFibonacci(int x){     return isPerfectSquare(5*x*x+4)||isPerfectSquare(5*x*x-4); } int main() {int n; scanf("%d",&n); if(isFibonacci(n)){     printf("YES"); } else printf("NO");    ...