count the numbers between 100 and 300, that star
with 2 and ends with 2

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is Exception handling possible in c language?

1586


Explain main function in c?

630


What are the restrictions of a modulus operator?

639


What is #pragma statements?

592


Is it better to use malloc() or calloc()?

650






How can I write a function that takes a format string and a variable number of arguments?

606


What are the 4 types of organizational structures?

626


What is difference between && and & in c?

600


Discuss the function of conditional operator, size of operator and comma operator with examples.

681


What are the keywords in c?

644


How can I manipulate individual bits?

609


What are the two types of structure?

579


What is double pointer in c?

591


Why is c faster?

595


What is the difference between declaring a variable by constant keyword and #define ing that variable?

2700