Forum Replies Created
Viewing 1 post (of 1 total)
- AuthorPosts
- [email protected]Participant
How to count all the three digit number tht lie between 100 to 300 and whose 1st & last digit is 2?
Ans:C123456789101112131415161718192021222324252627282930313233#include <iostream>using namespace std;void display(){int count = 0;for(int i = 100;i<300;i++){int value = i;if(((value%10)== 2) &&(value/100)==2){cout<<value<<endl;count++;}}cout<<"Total Number "<<count<<endl;}void main(){display();}output:202212222232242252262272282292Total Number 10 - AuthorPosts
Viewing 1 post (of 1 total)