- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I write in order with for loop or while loop?
Example
#include #include void main() { int i,j,a=0,b=1,n; clrscr(); printf("****************OUTPUT*****************
"); printf("enter the value of n : "); scanf("%d",&n); printf("
the required order is:
" ); for(i=1;i<=n;i++) { if(i==1) printf("%d. E",i); else { printf("%d. ",i); for(j=1;j<=i-1;j++) printf("%d",a); for(j=1;j<=i-1;j++) printf("%d",b); } printf("
"); } getch(); }
- Related Articles
- Python - How to convert this while loop to for loop?
- How to convert a Python for loop to while loop?
- Difference between for loop and while loop in Python
- do…while loop vs. while loop in C/C++
- For Versus While Loop in C
- How to write a while loop in a JSP page?
- How can I break an outer loop with PHP?
- Difference Between for and while loop
- Java while loop
- What are the differences between while loop and do-while loop in Java?
- How MySQL WHILE loop statement can be used in stored procedure?
- How to implement WHILE LOOP with IF STATEMENT MySQL?
- How does Python while loop work?
- How to use ‘while loop’ in Java?
- The while loop in Javascript

Advertisements