SlideShare a Scribd company logo
1
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
1) Write a code for the followingoutput.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Code:
#include <stdio.h>
intmain()
{
inti,j,k=4,c;
for(i=1;i<=5;i++)
{
for(c=1;c<=k;c++)
printf("");
for(j=1;j<=i;j++)
printf("%d",i);
printf("n");
k--;
}
}
Output:
2
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
2) Write a code for the followingoutput.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Code:
#include <stdio.h>
intmain()
{
inti,j,k=4,c;
for(i=1;i<=5;i++)
{
for(c=1;c<=k;c++)
printf("");
for(j=1;j<=i;j++)
printf("%d",j);
printf("n");
k--;
}
}
Output:
3) Write a code for the followingOutput:
1
2 3
4 5 6
7 8 9 10
Code: #include <stdio.h>
intmain()
{
int a,b,n=6;
for(a=1; a<=10; a++)
{
if(a==1|| a==2 ||a==4 || a==7)
{
3
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
printf("n");
for(b=1;b<=n; b++)
printf("");
n=n-2;
}
printf("%4d",a);
}
}
Output:
4) Write a code for the followingoutput.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Code:
#include<stdio.h>
#include<conio.h>
voidmain()
{
intlines,n=1,spaces,tabs=8, x,y=1;
for(lines=1;lines<=5;lines++)
{
for(spaces=1;spaces<=tabs;spaces++)
printf("");
printf("%4d",n);
if(lines>=3)
{
for(x=1;x<=y;x++)
{
if(x==2&&y==3)
printf("%4d",lines+1);
else
printf("%4d",lines-1);
}
y++;
4
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
}
if(lines>=2)
printf("%4d",n);
tabs=tabs-2;
printf("n");
}
getch();
}
Output:
5) Write a code for the followingoutput:
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
Code:
#include <stdio.h>
main()
{
inta,b,n=8;
for(a=1;a<=5;a++)
{
for(b=1;b<=n;b++)
{
printf("");
}
n=n-2;
if(a==1)
printf("%d",a);
if(a==2)
printf("%d%d%d",a,a+1,a);
if(a==3)
printf("%d%d%d%d%d",a,a+1,a+2,a+1,a);
if(a==4)
printf("%d%d%d%d%d%d%d",a,a+1,a+2,a+3,a+2,a+1,a);
5
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
if(a==5)
printf("%d%d%d%d%d%d %d %d%d",a,a+1,a+2,a+3,a+4,a+3,a+2,a+1,a);
printf("n");
}
}
Output:
6) Write a code for the followingOutput:
A
ABC
ABCDE
ABCDEFG
ABCDEFGHI
Code:
#include <stdio.h>
intmain()
{
inta=65,b,c,d=4;
while(a<=73)
{
for(b=1;b<=d;b++)
printf("");
for(c=65;c<=a;c++)
{
printf("%c",c);
}
d=d-1;
printf("n");
a=a+2;
}
}
6
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
Output:
7)Write a code for the followingOutput:
*
* *
* * *
* * * *
* * * * *
Code:
#include <stdio.h>
intmain()
{
intnor,row,sp,st;
printf("Enterthe numberof rows:");
scanf("%d",&nor);
for(row=1;row<=nor;row++)
{
for(sp=nor-row;sp>=1;sp--)
printf("");
for(st=1;st<=row;st++)
printf("*");
printf("n");
}
}
Output:
7
WrittenbyHazrat Bilal
Studentat Abdul Wali KhanUniversity
Contact No:+923209600215
7) Write a code for the followingoutput:
Code:
#include <stdio.h>
intmain()
{
inta,b,c,d;
for(a=1;a<=5;a++)
{
for(b=1;b<=a;b++)
printf("%d",b);
printf("n");
}
for(c=4;c>=1;c--)
{
for(d=1;d<=c;d++)
printf("%d",d);
printf("n");
}
}
Output:
Ad

More Related Content

What's hot (20)

Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
Jaydip JK
 
IIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY TrajectoryeducationIIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY Trajectoryeducation
Dev Singh
 
Unit 3. Input and Output
Unit 3. Input and OutputUnit 3. Input and Output
Unit 3. Input and Output
Ashim Lamichhane
 
Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder
Vishvesh Jasani
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
AkhilaaReddy
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
 
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
Nithin Kumar,VVCE, Mysuru
 
Automata theory -RE to NFA-ε
Automata theory -RE to  NFA-εAutomata theory -RE to  NFA-ε
Automata theory -RE to NFA-ε
Akila Krishnamoorthy
 
Ansi c
Ansi cAnsi c
Ansi c
dayaramjatt001
 
LET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERSLET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERS
KavyaSharma65
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in c
BUBT
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
RAJWANT KAUR
 
Chapter 2 : Balagurusamy_ Programming ANsI in C
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in C
BUBT
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
BUBT
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
DevoAjit Gupta
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
Syed Mustafa
 
Find Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall AlgorithmFind Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall Algorithm
Rajib Roy
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
Control statement in c
Control statement in cControl statement in c
Control statement in c
baabtra.com - No. 1 supplier of quality freshers
 
nested if.pptx
nested if.pptxnested if.pptx
nested if.pptx
HarishRagavB
 
Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
Jaydip JK
 
IIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY TrajectoryeducationIIT Jam math 2016 solutions BY Trajectoryeducation
IIT Jam math 2016 solutions BY Trajectoryeducation
Dev Singh
 
Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder Nesting of if else statement & Else If Ladder
Nesting of if else statement & Else If Ladder
Vishvesh Jasani
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
AkhilaaReddy
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
 
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
18CSMP68 VTU Mobile Application Develeopment Lab Manual by Nithin, VVCE, Mysuru
Nithin Kumar,VVCE, Mysuru
 
LET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERSLET US C (5th EDITION) CHAPTER 1 ANSWERS
LET US C (5th EDITION) CHAPTER 1 ANSWERS
KavyaSharma65
 
Chapter 6 Balagurusamy Programming ANSI in c
Chapter 6  Balagurusamy Programming ANSI  in cChapter 6  Balagurusamy Programming ANSI  in c
Chapter 6 Balagurusamy Programming ANSI in c
BUBT
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
RAJWANT KAUR
 
Chapter 2 : Balagurusamy_ Programming ANsI in C
Chapter 2 :  Balagurusamy_ Programming ANsI in CChapter 2 :  Balagurusamy_ Programming ANsI in C
Chapter 2 : Balagurusamy_ Programming ANsI in C
BUBT
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
BUBT
 
Strings Functions in C Programming
Strings Functions in C ProgrammingStrings Functions in C Programming
Strings Functions in C Programming
DevoAjit Gupta
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
Syed Mustafa
 
Find Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall AlgorithmFind Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall Algorithm
Rajib Roy
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 

Similar to Printing different pyramid patterns of numbers,alphabets and stars using C. (20)

pattern-printing-in-c.pdf
pattern-printing-in-c.pdfpattern-printing-in-c.pdf
pattern-printing-in-c.pdf
RSathyaPriyaCSEKIOT
 
Fuzail_File_C.docx
Fuzail_File_C.docxFuzail_File_C.docx
Fuzail_File_C.docx
SyedFuzail14
 
Automata fix.pdf
Automata fix.pdfAutomata fix.pdf
Automata fix.pdf
sudarshanhacker
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
TUSHARGAURAV11
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
TUSHARGAURAV11
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-year
AMIT SINGH
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
Zaibi Gondal
 
operators.ppt
operators.pptoperators.ppt
operators.ppt
gamingwithfaulty
 
Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...
Salar Delavar Qashqai
 
Lab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practiceLab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practice
ranaibrahim453
 
C Programming
C ProgrammingC Programming
C Programming
Sumant Diwakar
 
Technical quiz 5#.pptx
Technical quiz 5#.pptxTechnical quiz 5#.pptx
Technical quiz 5#.pptx
kamalPatelposhala
 
Qno 1 (f)
Qno 1 (f)Qno 1 (f)
Qno 1 (f)
Praveen M Jigajinni
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
Sarkunavathi Aribal
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
premrings
 
Assignement of c++
Assignement of c++Assignement of c++
Assignement of c++
Syed Umair
 
UNIT 2 LOOP CONTROL.pptx
UNIT 2 LOOP CONTROL.pptxUNIT 2 LOOP CONTROL.pptx
UNIT 2 LOOP CONTROL.pptx
Abhishekkumarsingh630054
 
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
Syed Umair
 
Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)
MountAbuRohini
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab File
Kandarp Tiwari
 
Fuzail_File_C.docx
Fuzail_File_C.docxFuzail_File_C.docx
Fuzail_File_C.docx
SyedFuzail14
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
TUSHARGAURAV11
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
TUSHARGAURAV11
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-year
AMIT SINGH
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
Zaibi Gondal
 
Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...
Salar Delavar Qashqai
 
Lab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practiceLab Manual IV (1).pdf on C++ Programming practice
Lab Manual IV (1).pdf on C++ Programming practice
ranaibrahim453
 
54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
premrings
 
Assignement of c++
Assignement of c++Assignement of c++
Assignement of c++
Syed Umair
 
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
Syed Umair
 
Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)Class xi sample paper (Computer Science)
Class xi sample paper (Computer Science)
MountAbuRohini
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab File
Kandarp Tiwari
 
Ad

Recently uploaded (20)

Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
How to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber PluginHow to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber Plugin
eGrabber
 
Let's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured ContainersLet's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured Containers
Gene Gotimer
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
cram_advancedword2007version2025final.ppt
cram_advancedword2007version2025final.pptcram_advancedword2007version2025final.ppt
cram_advancedword2007version2025final.ppt
ahmedsaadtax2025
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
File Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full VersionFile Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full Version
raheemk1122g
 
Quasar Framework Introduction for C++ develpoers
Quasar Framework Introduction for C++ develpoersQuasar Framework Introduction for C++ develpoers
Quasar Framework Introduction for C++ develpoers
sadadkhah
 
User interface and User experience Modernization.pptx
User interface and User experience  Modernization.pptxUser interface and User experience  Modernization.pptx
User interface and User experience Modernization.pptx
MustafaAlshekly1
 
Medical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk ScoringMedical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk Scoring
ICS
 
iTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation KeyiTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation Key
raheemk1122g
 
NYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdfNYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdf
AUGNYC
 
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdfLegacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Ortus Solutions, Corp
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb ClarkDeploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Peter Caitens
 
Welcome to QA Summit 2025.
Welcome to QA Summit 2025.Welcome to QA Summit 2025.
Welcome to QA Summit 2025.
QA Summit
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
How to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber PluginHow to Install and Activate ListGrabber Plugin
How to Install and Activate ListGrabber Plugin
eGrabber
 
Let's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured ContainersLet's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured Containers
Gene Gotimer
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
cram_advancedword2007version2025final.ppt
cram_advancedword2007version2025final.pptcram_advancedword2007version2025final.ppt
cram_advancedword2007version2025final.ppt
ahmedsaadtax2025
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
File Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full VersionFile Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full Version
raheemk1122g
 
Quasar Framework Introduction for C++ develpoers
Quasar Framework Introduction for C++ develpoersQuasar Framework Introduction for C++ develpoers
Quasar Framework Introduction for C++ develpoers
sadadkhah
 
User interface and User experience Modernization.pptx
User interface and User experience  Modernization.pptxUser interface and User experience  Modernization.pptx
User interface and User experience Modernization.pptx
MustafaAlshekly1
 
Medical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk ScoringMedical Device Cybersecurity Threat & Risk Scoring
Medical Device Cybersecurity Threat & Risk Scoring
ICS
 
iTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation KeyiTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation Key
raheemk1122g
 
NYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdfNYC ACE 08-May-2025-Combined Presentation.pdf
NYC ACE 08-May-2025-Combined Presentation.pdf
AUGNYC
 
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdfLegacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Legacy Code Nightmares , Hellscapes, and Lessons Learned.pdf
Ortus Solutions, Corp
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb ClarkDeploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Deploying & Testing Agentforce - End-to-end with Copado - Ewenb Clark
Peter Caitens
 
Welcome to QA Summit 2025.
Welcome to QA Summit 2025.Welcome to QA Summit 2025.
Welcome to QA Summit 2025.
QA Summit
 
Ad

Printing different pyramid patterns of numbers,alphabets and stars using C.

  • 1. 1 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 1) Write a code for the followingoutput. 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 Code: #include <stdio.h> intmain() { inti,j,k=4,c; for(i=1;i<=5;i++) { for(c=1;c<=k;c++) printf(""); for(j=1;j<=i;j++) printf("%d",i); printf("n"); k--; } } Output:
  • 2. 2 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 2) Write a code for the followingoutput. 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Code: #include <stdio.h> intmain() { inti,j,k=4,c; for(i=1;i<=5;i++) { for(c=1;c<=k;c++) printf(""); for(j=1;j<=i;j++) printf("%d",j); printf("n"); k--; } } Output: 3) Write a code for the followingOutput: 1 2 3 4 5 6 7 8 9 10 Code: #include <stdio.h> intmain() { int a,b,n=6; for(a=1; a<=10; a++) { if(a==1|| a==2 ||a==4 || a==7) {
  • 3. 3 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 printf("n"); for(b=1;b<=n; b++) printf(""); n=n-2; } printf("%4d",a); } } Output: 4) Write a code for the followingoutput. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 Code: #include<stdio.h> #include<conio.h> voidmain() { intlines,n=1,spaces,tabs=8, x,y=1; for(lines=1;lines<=5;lines++) { for(spaces=1;spaces<=tabs;spaces++) printf(""); printf("%4d",n); if(lines>=3) { for(x=1;x<=y;x++) { if(x==2&&y==3) printf("%4d",lines+1); else printf("%4d",lines-1); } y++;
  • 4. 4 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 } if(lines>=2) printf("%4d",n); tabs=tabs-2; printf("n"); } getch(); } Output: 5) Write a code for the followingoutput: 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 5 6 7 8 9 8 7 6 5 Code: #include <stdio.h> main() { inta,b,n=8; for(a=1;a<=5;a++) { for(b=1;b<=n;b++) { printf(""); } n=n-2; if(a==1) printf("%d",a); if(a==2) printf("%d%d%d",a,a+1,a); if(a==3) printf("%d%d%d%d%d",a,a+1,a+2,a+1,a); if(a==4) printf("%d%d%d%d%d%d%d",a,a+1,a+2,a+3,a+2,a+1,a);
  • 5. 5 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 if(a==5) printf("%d%d%d%d%d%d %d %d%d",a,a+1,a+2,a+3,a+4,a+3,a+2,a+1,a); printf("n"); } } Output: 6) Write a code for the followingOutput: A ABC ABCDE ABCDEFG ABCDEFGHI Code: #include <stdio.h> intmain() { inta=65,b,c,d=4; while(a<=73) { for(b=1;b<=d;b++) printf(""); for(c=65;c<=a;c++) { printf("%c",c); } d=d-1; printf("n"); a=a+2; } }
  • 6. 6 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 Output: 7)Write a code for the followingOutput: * * * * * * * * * * * * * * * Code: #include <stdio.h> intmain() { intnor,row,sp,st; printf("Enterthe numberof rows:"); scanf("%d",&nor); for(row=1;row<=nor;row++) { for(sp=nor-row;sp>=1;sp--) printf(""); for(st=1;st<=row;st++) printf("*"); printf("n"); } } Output:
  • 7. 7 WrittenbyHazrat Bilal Studentat Abdul Wali KhanUniversity Contact No:+923209600215 7) Write a code for the followingoutput: Code: #include <stdio.h> intmain() { inta,b,c,d; for(a=1;a<=5;a++) { for(b=1;b<=a;b++) printf("%d",b); printf("n"); } for(c=4;c>=1;c--) { for(d=1;d<=c;d++) printf("%d",d); printf("n"); } } Output:
  翻译: