The question is meaningless.
Chat with our AI personalities
To do this manually, you can simply read through the number, keeping a manual tally in your head. If you are looking for an algorithm to do it for you, here is one method that would work in C, where "number" is the value being tested and "digit" is the digit we're counting: ... int whole = (int)number; number -= whole; tally = 0; while(whole != 0){ if(whole % 10 digit) tally++; number -= (int)number; } printf("We counted %i digits occurrences of the digit %i\n", tally, digit); ...
#include<iostream.h> #include<conio.h> void main(){ int Number[10]; cout<<"Enter ten numbers"; for (int i=0;i<10;i++) cin>>Number[i]; int Big=0; for(int j=0;j<10;j++){ if (Big<Number[i]) Big=Number[i]; } cout<<"gretest Number:"<<Big; getch(); }
int factorial(int n) { int i; int f=1; for(i=2;i<=n;++i) f*=i; return f; }
public class FindLeastAndGreatest { public static void main(String[] args) { // number can't be equal with each other int a = 7; int b = 7; int c = 6; System.out.println(least(a,b,c)); System.out.println(greatest(a,b,c)); } public static int least(int a, int b, int c) { int least = 0; if(a < b && a < c) { least = a; } else if(b < a && b < c) { least = b; } else { least = c;} return least; } public static int greatest(int a, int b, int c) { int greatest = 0; if(a > b && a > c) { greatest = a; } else if(b > a && b > c) { greatest = b; } else { greatest = c;} return greatest; } }
/*program to find the factorial of a given number*/ #include<stdio.h> #include<conio.h> int fact(int); void main() { int n,c; printf("\n enter the number for which you want to find the factorial"); scanf("%d",&n); c=fact(n); printf("\n the factorial of the number %d is %d",n,fact); getch(); } int fact(int n) { int k; if(n==0) return(1); else k=n*fact(n-1); return(k); }