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
Explain what is the stack?
What is the difference between array and structure in c?
What is the difference between fread buffer() and fwrite buffer()?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
How can type-insensitive macros be created?
ATM machine and railway reservation class/object diagram
Why do we use int main instead of void main in c?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
What are the salient features of c languages?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Is using exit() the same as using return?
Explain how do you determine the length of a string value that was stored in a variable?
Explain 'far' and 'near' pointers in c.
a program that can input number of records and can view it again the record
Explain logical errors? Compare with syntax errors.