write a program that input four digit number and find how
many 7 that number contains

Answer Posted / vitthal kadam

#include<iostream.h>

int main ()
{
int num,cnt,temp;
char ch;
cout<< "Enter any number in between [0-99999]: ";
cin >> num;
temp = num;
cnt = 0;
while (temp)
{
if (temp%10 == 7)
cnt++;
temp = temp/10;
}
cout<<"count of 7 in the entered number is " << cnt ;
cin>>ch;
return 0;
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is stl open source?

646


How is stl different from c++ standard library?

755


Can we use stl in coding interviews?

1292


How do you convert stl to steps?

641


What is stl stand for?

744






What does stl mean in slang?

658


What are the different types of stl containers?

657


What two types of containers does the stl provide?

577


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1985


Is there any error below, its a code to delete all entires from a map #include #include iostream.h int main() { int i =0; map TestMap; while(i<3) { TesMap.insert(TestMap::value_type(i,Test)); i++; } typedef map :: iterator mapIter =TestMap.begin(); if(mapIter!=TestMap.end()) { TestMap.erase(mapItrer); ++mapIter; } return 0; }

1904


write a program that will accept a number and print.its equivalent in words the maximum input number is 9999

2511


What is a standard template library (stl)? What are the various types of stl containers?

679


How connect plc and pc through software

1928


In what scenario does the Logical file and Physical file being used?

2334


totoo po ba ang manga aliens!

2347