1 to 100

Assalamu Alaikum. Hope you all are well by the grace of Almighty ALLAH. Today we learn how to print 1 to 100. Take a look at the program.


In the example above, while loop is used. we can also write this program with for loop.


We can also do this with do while loop.


If we take an integer variable (suppose n), take the value of n from the user and in the condition instead of i<=100, write i<=n it will be print up to n numbers.Take a look at the program.


If we want to print 1 to 100 in 5 columns then the code will be looked like the following:




Thank you all..:)



0 comments:

Post a Comment