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 |
how to copy a string without using c function
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack
What do you mean by a sequential access file?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
Difference between goto, long jmp() and setjmp()?
Write a program to use switch statement.
0 Answers Agilent, Integreon, ZS Associates,
what is the other ways to find a logic to print whether a number is an even or odd wit out using % symbol??????? i know three different ways to print it. so i need any other different logic>>>>>
What is 2c dna?
the operator for exponencation is a.** b.^ c.% d.not available
write a program to print infinte number
What are the different types of control structures in programming?
write a program to swap bits in a character and return the value prototype of function char fun (char a, charb flag c) where fun returns a char, char a is a the value char b is the bit to be changed and flag c is the bit value for eg: x=fun(45,7,0) since 45 is 0010 0101 and ow x should contain the value 65 (0110 0101)
1 Answers Bosch, College School Exams Tests,