Enter your email address:


Monday, September 2, 2013

Home » , » Count the Total Number of 7 comming between 1 to 100.

Count the Total Number of 7 comming between 1 to 100.

Questions: Top-30-c-programs-asked-in-interview_6304.html

28.Count the Total Number of 7 comming between 1 to 100.

/* I made this code in a way that u can give Upper limit i.e. 100,Lower limit i.e. 1 and the specific number u wants to count in between i.e. 7 */

#include
#include
void main()
{
int i,j,U=100, L=1,count= 0,r=1,n;
clrscr();
printf("\n Enter the number u wants to count\n:");
scanf("%d" ,&n);
printf("\n Enter the lower limit\n:");
scanf("%d" ,&L);
printf("\n Enter the upper limit\n:");
scanf("%d" ,&U);

for (i=L;i
{
j=i;
while(j)
{
r=j%10;
if (r==n)
{
count++;
}
j=j/10;
}
}
if(n==0&&L ==0)
count++;
printf("\n Total Number of %d between %d and %d = %d",n,L,U, count);
getch();
}

Share this games :

1 comments:

Shubham garg said...

Plz change color combinationn of text and background

Post a Comment

Related Posts