Answer to Question #210892 in C for genji

Question #210892

Program to display a positive number, if user enters negative number that number won't be displayed by using IF statement.


1
Expert's answer
2021-06-27T14:10:42-0400


#include <stdio.h>
#include <stdlib.h>

main(void)
{
	int n, Flag=1;
	while(Flag)
	{
		printf("\nEnter a +ve number: "); scanf("%d",&n);
		if(n>=0) printf("The number is %d",n);
		printf("\n\nPress 1 to Continute or 0 to QUIT: "); scanf("%d",&Flag);
	}
	return(0);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS