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.
...