63
#include<stdio.h> #include<conio.h> main() { int n,max=0,rem; printf("\n enter a number"); scanf("%d",&n); while(n!=0) { rem=n%10; n=n/10; if(rem>max) { max=rem: }} printf("\n the largest digit is: %d",max); getch(); }
int max = a>b?a:b; // set max to the larger of a and b
it was invented in 1950 when a Australian man Max Carter invented it because he wanted to make sense with direct numbers
max = a > b ? a : b; max = max > c ? max : c;
max[x*y | x and y belong to {0,1,2,3,4,5,6,7,8,9}]
63
#include<stdio.h> #include<conio.h> void main() { int z,i,max=0; clrscr(); for(i=1;i<=5;i++) //change the digit 5 to anything { printf("Enter a number":); scanf("%d",&z); if(z>max) max=z; } printf("Largest number is=%d"z); getch(); }
#include#includevoid main(){long int n,r,m,max=0,count=0;clrscr();printf("Enter the Number:");scanf("%ld",&n);m=n;while(n>0){r=n%10;if(r>max)max=r;n=n/10;}printf("\nLargest Digit is = %ld",max);while(m>0){r=m%10;if(r==max)count++;m=m/10;}printf("\n\nOccurence of Largest Digit %ld is = %ld",max,count);getch();}output:Enter the Number:68596999Largest Digit is = 9Occurence of Largest Digit 9 is = 4
#include<stdio.h> #include<conio.h> main() { int n,max=0,rem; printf("\n enter a number"); scanf("%d",&n); while(n!=0) { rem=n%10; n=n/10; if(rem>max) { max=rem: }} printf("\n the largest digit is: %d",max); getch(); }
19
The largest 3-digit prime number must be less than 1000, so work backwards from there. #include<iostream> #include<cmath> bool is_prime (const unsigned); // forward declaration int main () { unsigned n = 1000; while (!is_prime(--n)); std::cout << "The largest 3-digit prime is " << n << std::endl; } bool is_prime (const unsigned num) { if (num<2) return false; if (!(num%2)) return num==2; unsigned max = (unsigned) std::sqrt (num) + 1; for (unsigned div=3; div<max; ++div) if (!(num%div)) return false; return true; }
int max = a>b?a:b; // set max to the larger of a and b
max=number min=number counter=1 start while(counter<=3) read number start if max<number max=number else if min>number min=number end while write max write min /*modify the counter switch according to the number of values being compared if required*/
WikiAnswers does not give out personal information such as phone numbers.
#include<stdio.h> #include<conio.h> void main() { int a[4],max,i; clrscr(); printf("Enter the four numbers:\n"); for(i=0;i<4;i++) scanf("%d",a[i]); max=a[o]; for(i=1;i<4;i++) { if(a[i]>max) { max=a[i]; } } printf("The Greatest number is %d",max); getch(); }
In Lotto Max, having three numbers matched does not result in a direct win. To win a prize in Lotto Max, you typically need to match at least three numbers plus the bonus number, or more numbers. Matching three numbers without the bonus number usually does not result in a win, as the prize structure is based on matching more numbers.