answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main( )

{

int a[50],i,n,s,t=0;/* the digit 50 can be any integer, its a user defined function a[limit]*/

clrscr( );

printf("\n\nenter the number of elements u want to enter");

scanf("%d",&n);

printf("\n\nenter the numbers u desire");

for(i=0;i<n;i++)

scanf("%d",&a[i]);

printf("enter the element to be counted");

scanf("%d",&s);

for(i=0;i<n;i++)

{

if(s==a[i])

t++;

}

printf("the number u entered has occured %d number of times",t);

getch( );

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

// set up our input buffer

BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

String currentLine;

boolean readAnInt = false;

// keep reading input until an integer is input

while (!readAnInt) {

currentLine = in.readLine();

try {

// try to convert from string to int

Integer.parseInt(currentLine);

// now we know we have an integer: print number of digits

System.out.println("Number of Digits: " + currentLine.length());

readAnInt = true;

} catch (final NumberFormatException ex) {

// we go here if the user didn't type in an integer

}

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

#include<stdio.h>

#include<conio.h>

int main()

{

char a[]={'s','h','i','k','h','a','\0'};

int i,count=0;

for(i=0;a[i]!='\0';i++);

printf("%d",i);

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to count the number of times the digit is present?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a C programme to count the number of vowals present in your name?

abhimanyu


It 4-1 solved question papers November -2008?

Write a program to count the number of IS in any number in register B and put the count in R5.


Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Write a program to get table of a number?

#include "stdio.h" #include "conio.h" #define TABLE_UP_TO_20 20 void table_of_a_number(int number); int main() { int i = 0x00; printf("Enter a positive number in decimal whose table has to be generated"); scanf("%d",&amp;i); table_of_a_number(i); return 0; } void table_of_a_number(int number) { int count = 0x00; for(count = 0x01;count &lt;=TABLE_UP_TO_20 ;count++) { /* THis will print the table*/ printf(" %d * %d = %d\n", number,count, (number*count)); }


Write a program that ask the user to enter a number n and display the first n even numbers?

#include "stdio.h" int main() { unsigned int number, count; printf("Enter the Number \t"); scanf("%d", &amp;number); printf("The even numbers are: \n"); for(count = 0x01; (count &lt; number &amp;&amp; number!= 0x00)) { if(count%2) { }else { printf("%d\n", count); } count++; } return 0; }


How would you write a program that counts the number of lowercase in a character?

I would use a loop like this: const char *p= str-1; size_t count= 0; while (*++p) if (islower (*p)) ++count;


How do you write a c program that counts number of blanks in a text file using standard io?

int count_whitespace (FILE* input) { int c, count=0; while (( c = getc(input) ) != EOF ) if ((char) c==' ') ++count; return count; }


How do you write a program in c that will count from 1 to 10 and its square for each count?

int i; for (i=1; i&lt;=10; i++) printf ("%d %d\n", i, i*i);


Program to count the number of characters and words in the line?

in linux wc -l filename will count the lines and wc will count the letters


How do you Write a program that determines the number of occurrences of each digit in a given integer n?

there could be a part in it like this: int num, digit; int count [10]; do { digit = num%10; num != 10; ++count[digit]; } while (num);


What is the total number of receptors present in a human body?

too many to count


How to write repeated multiplication of a factor by using an exponent?

To write repeated multiplication in an exponential notation, you should write the number that has to be multiplied as the base. Count the number of times that the number is used.