write a program to display the numbers having digit 9 in the
given range from 1 to 100

Answer Posted / neha

public class DisplayNumbers {
public static void main(String args[])
{
int num=0,Nine=9;
for(int i=1;i<100;i++)
{
int rem=i/10;

num=i%10;

if(num==Nine || rem==Nine)
{
System.out.println("Number is :: "+ i);
}
}
}

}

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different categories of functions in c?

639


What is the difference between array and linked list in c?

593


Differentiate between static and dynamic modeling.

612


What are the __date__ and __time__ preprocessor commands?

566


#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }

621






What is type qualifiers?

653


What is extern keyword in c?

637


In C, What is the #line used for?

1045


Why main is not a keyword in c?

641


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

1844


Can a variable be both static and volatile in c?

602


Write a program to print fibonacci series without using recursion?

599


What is the difference between exit() and _exit() function in c?

578


Write a program on swapping (100, 50)

634


what do the 'c' and 'v' in argc and argv stand for?

640