count the numbers between 100 and 300, that star
with 2 and ends with 2
Answer Posted / sujit
#include<stdio.h>
void main(void)
{
int i,d1,d2,count=0;
for(i=100;i<=300;i++)
{
while(i>0)
{
d1=i%10;
i=i/10;
d2=i%10;
i=i/10;
if(d1==2&&i==2)
count++;
}
}
printf("%d",count);
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Is c easier than java?
What is the use of function in c?
How variables are declared in c?
Explain b+ tree?
What is the difference between text files and binary files?
Is it possible to pass an entire structure to functions?
What is the meaning of && in c?
Explain built-in function?
What is sizeof in c?
Explain how do you sort filenames in a directory?
What are register variables in c?
What are two dimensional arrays alternatively called as?
What are the uses of a pointer?
What do you mean by scope of a variable in c?
What does the c preprocessor do?