Tuesday, April 14, 2020

While loop in C

  • Flowchart :
  • Syntax :
while (condition test)
{
      //Statements to be executed repeatedly 
      // Increment (++) or Decrement (--) Operation
}
  • Program :
#include<stdio.h>
#include<conio.h>
void main ()
{
   int n,time;
   clrscr();
   printf("\n----------------WHILE LOOP----------------");
   printf("\nEnter n and time value :");
   scanf("%d%d",&n,&time);
   while(n<=time)
   {
      printf("\n n = %d",n);
      n++;
   }
  getch();
}

  • Output :




No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...