Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

while loop using logical operators

0 votes
asked Sep 20, 2019 by krishna

2 Answers

0 votes
answered Sep 20, 2019 by anonymous
the three logical operator are :-
logical AND(&&)
logical OR(||)
logical NOT(!)
#include <stdio.h>
int main()
{
   int i=1, j=1;
   while (i <= 4 || j <= 3)   //here we use the logical OR operator which check condition                   
   {
	printf("%d %d\n",i, j);
	i++;
	j++;
   }
   return 0;
}

Output:

1 1
2 2
3 3
4 4
0 votes
answered Sep 20, 2019 by Raja Sekhar (260 points)
while((i<15) && (i!=5))

{

printf("%d",i);

i++

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...