SOURCE CODE OUTPUT
#include <iostream>
using namespace std;
int main()
{
int num,maxi=0,temp;
cout<<"Enter the number ";
cin>>num;
while(num)
{
if(maxi<num%10)
maxi=num%10;
num/=10;
}
cout<<"Maximum digit is "<<maxi;
return 0;
}
using namespace std;
int main()
{
int num,maxi=0,temp;
cout<<"Enter the number ";
cin>>num;
while(num)
{
if(maxi<num%10)
maxi=num%10;
num/=10;
}
cout<<"Maximum digit is "<<maxi;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment