SlideShare una empresa de Scribd logo
1 de 5
                     Collection of program<br />Program to print double pyramid<br />void main(void){clrscr();int i,j,k,l,b,n;printf(quot;
Enter the value of N:quot;
);scanf(quot;
%dquot;
,&n);for(i=0;i{printf(quot;
quot;
);for(l=0;lprintf(quot;
 quot;
);for(j=i+1;j<=n;j++)printf(quot;
%dquot;
,j);for(k=n-1;k>i;k--)printf(quot;
%dquot;
,k);}b=n-1;for(i=0;i{printf(quot;
quot;
);for(l=n-2;l>i;l--)printf(quot;
 quot;
);for(j=b;j<=n;j++)printf(quot;
%dquot;
,j);for(k=n-1;k>=b;k--)printf(quot;
%dquot;
,k);b--;}getch();}<br />WAP to print fabbonic series from 1 to 55<br />void main ()<br />{<br />int a,b,c;<br />clrscr ();<br />a=0;b=1;c=1;<br />printf (quot;
%d%dquot;
,a,b);<br />while (c<55)<br />{<br />c=a+b;<br />printf (quot;
%dquot;
,c);<br />a=b;<br />b=c;<br />}<br />getch ();<br />}<br />factorial<br />#include quot;
stdio.hquot;
#include quot;
conio.hquot;
long int factorial(int n);void main(){int n,i;float s,r;char c;clrscr();repeat : printf(quot;
You have this series:- 1/1! + 2/2! + 3/3! + 4/4!quot;
);printf(quot;
To which term you want its sum? quot;
);scanf(quot;
%dquot;
,&n);s=0;for (i=1;i<=n;i++){s=s+((float)i/(float)factorial(i));}printf(quot;
The sum of %d terms is %fquot;
,n,s);fflush(stdin);printf (quot;
Do you want to continue?(y/n):- quot;
);scanf(quot;
%cquot;
,&c);if (c=='y')goto repeat;getch();}long int factorial(int n){if (n<=1)return(1);elsen=n*factorial(n-1);return(n);} <br />//C Program to Print Square of Stars#include<stdio.h>#include<conio.h>void main(){int a,b;clrscr();for(a=1;a<=3;a++){for (b=1;b<=a;b++){if(a==2&&b==2){printf(quot;
 quot;
);}else{printf(quot;
*quot;
);}}for(b=(3-a);b>=1;b--){printf(quot;
*quot;
);}printf(quot;
quot;
);}getch();}<br />/*c program for printing Pascal's Triangle*/#include <stdio.h>#include <conio.h>void main(){int p[10][10];int i,j,k;clrscr();printf(quot;
Pascal's Trianglequot;
);for(i=0;i<10;i++){j=1;p[i][0]=1;p[i][i]=1;while(j<i){p[i][j]=p[i-1][j-1]+p[i-1][j];j++;}}for(i=0;i<10;i++){j=10;while(j>i){printf(quot;
  quot;
);j--;}for(k=0;k<=i;k++){printf(quot;
%4dquot;
,p[i][k]);}printf(quot;
quot;
);}getch();}<br />//C Program to Round Up a Number#include<stdio.h>#include<conio.h>void main(){float n;int i;clrscr();printf(quot;
Enter the Valuequot;
);scanf(quot;
%fquot;
,&n);i=(n<0)?n-0.5:n+0.5;printf(quot;
Round up value= %dquot;
,i);getch();}<br />Fuuny program<br />#include<stdio.h>#include<conio.h>void main(){char ch[]=quot;
I AM AN IDIOT.quot;
;char c='A';int i=0;while(c){c=getch();printf(quot;
%cquot;
,ch[i]);i++;if(i==14){printf(quot;
 quot;
); i=0;}}}<br />http://free-c-programs.blogspot.com<br />by ujjwal kaushik<br />
Program for pyramid
Program for pyramid
Program for pyramid
Program for pyramid

Más contenido relacionado

La actualidad más candente

La actualidad más candente (16)

Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3
 
week-1x
week-1xweek-1x
week-1x
 
C workshop day 6
C workshop day 6C workshop day 6
C workshop day 6
 
week-10x
week-10xweek-10x
week-10x
 
1 (1)
1 (1)1 (1)
1 (1)
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1Bcsl 033 data and file structures lab s2-1
Bcsl 033 data and file structures lab s2-1
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
Bcsl 033 data and file structures lab s1-1
Bcsl 033 data and file structures lab s1-1Bcsl 033 data and file structures lab s1-1
Bcsl 033 data and file structures lab s1-1
 
Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3Bcsl 033 data and file structures lab s2-3
Bcsl 033 data and file structures lab s2-3
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
week-11x
week-11xweek-11x
week-11x
 
Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3
 
week-18x
week-18xweek-18x
week-18x
 
Write a program to perform translation.
 Write a program to perform translation. Write a program to perform translation.
Write a program to perform translation.
 
Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.Printing different pyramid patterns of numbers,alphabets and stars using C.
Printing different pyramid patterns of numbers,alphabets and stars using C.
 

Destacado (7)

Introductiuon to cad
Introductiuon to cadIntroductiuon to cad
Introductiuon to cad
 
Solutions tohc vermasconceptsofphysics2
Solutions tohc vermasconceptsofphysics2Solutions tohc vermasconceptsofphysics2
Solutions tohc vermasconceptsofphysics2
 
Engineering line
Engineering lineEngineering line
Engineering line
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
Engineering graphics
Engineering graphicsEngineering graphics
Engineering graphics
 
Engg curves
Engg curvesEngg curves
Engg curves
 
Gnuplot
GnuplotGnuplot
Gnuplot
 

Similar a Program for pyramid

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
C basics
C basicsC basics
C basics
MSc CST
 

Similar a Program for pyramid (20)

Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Spiral array
Spiral arraySpiral array
Spiral array
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
 
9.C Programming
9.C Programming9.C Programming
9.C Programming
 
Automata fix.pdf
Automata fix.pdfAutomata fix.pdf
Automata fix.pdf
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
programs
programsprograms
programs
 
C basics
C basicsC basics
C basics
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
 
C Programming
C ProgrammingC Programming
C Programming
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
Graphics point clipping c program
Graphics point clipping c programGraphics point clipping c program
Graphics point clipping c program
 
Struct examples
Struct examplesStruct examples
Struct examples
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Program for pyramid

  • 1. Collection of program<br />Program to print double pyramid<br />void main(void){clrscr();int i,j,k,l,b,n;printf(quot; Enter the value of N:quot; );scanf(quot; %dquot; ,&n);for(i=0;i{printf(quot; quot; );for(l=0;lprintf(quot; quot; );for(j=i+1;j<=n;j++)printf(quot; %dquot; ,j);for(k=n-1;k>i;k--)printf(quot; %dquot; ,k);}b=n-1;for(i=0;i{printf(quot; quot; );for(l=n-2;l>i;l--)printf(quot; quot; );for(j=b;j<=n;j++)printf(quot; %dquot; ,j);for(k=n-1;k>=b;k--)printf(quot; %dquot; ,k);b--;}getch();}<br />WAP to print fabbonic series from 1 to 55<br />void main ()<br />{<br />int a,b,c;<br />clrscr ();<br />a=0;b=1;c=1;<br />printf (quot; %d%dquot; ,a,b);<br />while (c<55)<br />{<br />c=a+b;<br />printf (quot; %dquot; ,c);<br />a=b;<br />b=c;<br />}<br />getch ();<br />}<br />factorial<br />#include quot; stdio.hquot; #include quot; conio.hquot; long int factorial(int n);void main(){int n,i;float s,r;char c;clrscr();repeat : printf(quot; You have this series:- 1/1! + 2/2! + 3/3! + 4/4!quot; );printf(quot; To which term you want its sum? quot; );scanf(quot; %dquot; ,&n);s=0;for (i=1;i<=n;i++){s=s+((float)i/(float)factorial(i));}printf(quot; The sum of %d terms is %fquot; ,n,s);fflush(stdin);printf (quot; Do you want to continue?(y/n):- quot; );scanf(quot; %cquot; ,&c);if (c=='y')goto repeat;getch();}long int factorial(int n){if (n<=1)return(1);elsen=n*factorial(n-1);return(n);} <br />//C Program to Print Square of Stars#include<stdio.h>#include<conio.h>void main(){int a,b;clrscr();for(a=1;a<=3;a++){for (b=1;b<=a;b++){if(a==2&&b==2){printf(quot; quot; );}else{printf(quot; *quot; );}}for(b=(3-a);b>=1;b--){printf(quot; *quot; );}printf(quot; quot; );}getch();}<br />/*c program for printing Pascal's Triangle*/#include <stdio.h>#include <conio.h>void main(){int p[10][10];int i,j,k;clrscr();printf(quot; Pascal's Trianglequot; );for(i=0;i<10;i++){j=1;p[i][0]=1;p[i][i]=1;while(j<i){p[i][j]=p[i-1][j-1]+p[i-1][j];j++;}}for(i=0;i<10;i++){j=10;while(j>i){printf(quot;   quot; );j--;}for(k=0;k<=i;k++){printf(quot; %4dquot; ,p[i][k]);}printf(quot; quot; );}getch();}<br />//C Program to Round Up a Number#include<stdio.h>#include<conio.h>void main(){float n;int i;clrscr();printf(quot; Enter the Valuequot; );scanf(quot; %fquot; ,&n);i=(n<0)?n-0.5:n+0.5;printf(quot; Round up value= %dquot; ,i);getch();}<br />Fuuny program<br />#include<stdio.h>#include<conio.h>void main(){char ch[]=quot; I AM AN IDIOT.quot; ;char c='A';int i=0;while(c){c=getch();printf(quot; %cquot; ,ch[i]);i++;if(i==14){printf(quot; quot; ); i=0;}}}<br />http://free-c-programs.blogspot.com<br />by ujjwal kaushik<br />