In this program we will find that input value from user is zero or not, without using comparator operator. For this purpose we will user if-else conditional statement. If user if enter zero then zero will go inside if, and we all know that if statement doesn't work on zero, so else condition will become true and it will be executed.
Program:
// Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com
#include<iostream>
using namespace std;
int main()
{
int n=0;
cout<<"Enter Number: ";
cin>>n;
if(n)
{
cout<<"Number is non-zero";
}
else
cout<<"Number is Zero";
}
ReplyDeletenice article for beginners.thank you.
c++ tutorial
java tutorial
Really Great Post The Author is very well known about the topic. C++ Programming Complete Notes
ReplyDelete