count the numbers between 100 and 300, that star
with 2 and ends with 2
Answers were Sorted based on User's Feedback
Answer / amit sachan
int main()
{
int r,i,q,count=0;
for(i=100;i<300;i++)
{
r=i%10;
q=i/100;
if(r==2&&q==2)
count++;
}
printf("the total no=%d",count)
return(0);
}
| Is This Answer Correct ? | 40 Yes | 1 No |
Answer / hana
in between 100 to 300 means 200 to 299...
if u see which starts with 2 and ends with 2 then 202,212,222,232,242,252,262,272,282,292....
hence answer is 10..
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / 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 |
Answer / sushma s
PL\SQL Code:
Declare
n number(10) := 0;
begin
for i in 100 .. 300
loop
if (substr(i,1,1) =2) and (substr(i,length(i),1) = 2) then
n := n +1;
dbms_output.put_line('number :'|| i ||' count:' ||n);
end if;
end loop;
end;
O/P: count: 10
| Is This Answer Correct ? | 1 Yes | 1 No |
What is bubble sort technique in c?
LOGIC OF Bodmas?
What is c standard library?
When is a “switch” statement preferable over an “if” statement?
if the total selling price of 15 items and the total profit earned on them is input through the keyboard, write a program to find the cost price of one of the item
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
What is the newline escape sequence?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What is a lookup table in c?
How will you allocate memory to double a pointer?
What is period operator in c?
What is a union?