Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  count1
Language: C/C++
Code:
#include<stdio.h>
#include<conio.h>
int a,b,i,k,t,n,c,j,s;
int main()
{
     
     printf("enter lower range");
     scanf("%d",&a);
     printf("enter higher range");
     scanf("%d",&b);
     printf("enter digit");
     scanf("%d",&k);
      c=0;
      if(a>b)
      printf("invalid");
     for(i=a;i<=b;i++)
         {
                      j=i;
          
                      
                         n=j%10;
                         j=j/10;
                                              
                         if(n==k || j==k)
                         c++;
                      if(n==j)
                      {
                              s=n;
                              if(s==k)
                              c=c+1;
                     
                         }}
           printf("%d",c);
         getch();
         return 0;
}

          
          
Comments: