রবিবার, ৩ মে, ২০১৫

Syndicating Pyramid print with C language

#include<stdio.h>

int main(){

int n,i,j,k;

printf("Please Enter a Integer Number:\t");
scanf("%d",&n);

for(i=n;i>=1;i--){
for(k=i;k<=n-1;k++){
printf(" ");
}
for(j=1;j<=i;j++){
printf(" *");
}
printf("\n");
}
return 0;
}

output :

Pyramid in C Language

#include<stdio.h>

int main(){

int n,i,j,k;

printf("Please Enter a Integer Number:\t");
scanf("%d",&n);

for(i=1;i<=n;i++){
for(k=i;k<=n-1;k++){
printf(" ");
}
for(j=1;j<=i;j++){
printf(" *");
}
printf("\n");
}
return 0;
}

Output:

Fibonacci Series with C Programming

// Fibonacci Series in C Programming
#include<stdio.h>

int main(){
   int n,i, a = 0, b = 1, fib;

   printf("Enter the number of terms:");
   scanf("%d",&n);

   printf("First %d Number of Fibonacci series are :\t",n);

   for ( i = 0 ; i < n ; i++ ){
      if ( i <= 1 )
         fib = i;
      else{
         fib = a + b;
         a = b;
         b = fib;
      }
      printf("%d\t",fib);
   }

   return 0;
}

Output