Sunday, December 2, 2012

Larger value in two numbers using conditional operator in C++


#include<iostream.h>
int main()
{
int a,b,r;
cout<<"Enter two numbers to calculate bigger number \n";
cin>>a>>b;
r=a>b?a:b;
cout<<"The largest number is"<<r;
return 0;
}

No comments:

Post a Comment

DC motor control with Pulse Width Modulation Part 1

DC Motor intro DC motor is a device which converts electrical energy into kinetic energy. It converts the DC power into movement. The typica...