Print all numbers which has a certain digit in a certain
position
eg:
number=45687
1 number=4
2 number=5
etc

Answer Posted / eranna kybarshi

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,t,cnt=0;
int num[10];
clrscr();
printf("\nEnter The No.");
scanf("%d",&n);
while(n%10!=0)
{
t=n%10;
num[cnt]=t;
n=n/10;
cnt++;
}
num[cnt]='\0';

for(i=cnt-1;i>-1;i--)
printf("\n %d number= %d",cnt-i,num[i]);
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by inheritance?

636


given post order,in order construct the corresponding binary tree

2326


What does int main () mean?

555


what does static variable mean?

658


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

818






Where we use clrscr in c?

712


How can I recover the file name given an open stream or file descriptor?

600


Is this program statement valid? INT = 10.50;

691


What is the difference between variable declaration and variable definition in c?

566


What is a good way to implement complex numbers in c?

600


What is the right type to use for boolean values in c?

589


What is dynamic memory allocation?

812


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1598


How can I handle floating-point exceptions gracefully?

637


When should structures be passed by values or by references?

588