BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/300-object-oriented-programming/)
-   -   A Program to find a greater digit in a four digit number. (http://bzupages.com/f300/program-find-greater-digit-four-digit-number-15933/)

JuNaiDiQbaL 08-05-2011 11:12 PM

A Program to find a greater digit in a four digit number.
 
1- #include
2- #include
3- void main()
4- {
5- int num, a, b, c, d, mod;
6- cout<<"Enter Four Digit Number\n";

7- cin>>num;

8- a=num/1000;

9- mod=num%1000;

10- b=mod/100;

11- mod=mod%100;

12- c=mod/10;

13- mod=mod%10;

14- d=mod;

15- if(a>b && a>c && a>d)
16 cout<<" The Digit "< 17- else if(b>a && b>c && b>d)
18- cout<<" The digit "< 19- else if(c>a && c>b && c>d)
20- cout<<"" The digit "< 21- else
22- cout<<"The Digit "<
23- getch();
24- }

OUTPUT
Enter Four Digit Number
4567
The digit 7 is Greater


All times are GMT +5. The time now is 04:31 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.