Hello Friend’s
Today we are going to learn
about “while loop” and write a programe to increase or decrease a given number .
First fall we know that what
is while loop so, while loop is c programming loop which run the function until
camand is going to be false ( means if camand is true the while loop run
and until camand is not false it continuous increment or decrement ) in short if camand
is false then while loop is not execute .
In while loop we are initialise
the variable , give condition to variable and increment or decrement of the
variable
Sintex of while loop is..
Now I hope so you can
understand while loop.
So, now we are
going to write a program using while loop to print the number upto 10 in
accending order or decending order.
- 1. Increment
- 2.
Decrement
#include<stdio.h>
int main(){
int i=10;
while(i>=1){
printf("%d\n",i);
i--;
}
return 0;
}
2 Comments
Please check my website.
ReplyDeletewww.greedyhacks.gq
nice brother
Delete