- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Print first m multiples of n in C#
To print m multiples of n, first set the value of m and n −
int n = 6, m = 1;
Now loop through the value of m, increment it and multiply with n on every iteration −
while (m <= 5) { // multiply n*m m++; }
Let us see the complete code −
Example
using System; public class Demo { public static void Main() { int n = 6, m = 1; while (m <= 5) { Console.WriteLine(" {0}
", n * m); m++; } } }
Output
6 12 18 24 30
Advertisements