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
What are formal parameters?
What are valid operations on pointers?
Is there anything like an ifdef for typedefs?
Is there any data type in c with variable size?
main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
What is the right type to use for boolean values in c? Is there a standard type?
What are c preprocessors?
What is the purpose of the preprocessor directive error?
What is the difference between malloc() and calloc() function in c language?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
c language interview questions & answer
What is #define size in c?
Can you pass an entire structure to functions?
What is extern variable in c with example?