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

How stl is different from the c++ standard library?

855


What is meant by stl in c++?

881


How connect plc and pc through software

2171


Do you like to Submit Questions in Bulk under Same Category?? Then use our Bulk ListerDo you like to Submit Questions in Bulk under Same Category?? Then use our Bulk Lister

1865


what is template and type convertion

2221


Is stl part of c++ standard?

831


What is stl language?

859


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; }

2136


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.

2182


What is a stl vector?

831


What does stl mean in slang?

846


What does stl stand for in basketball?

842


What are the various types of stl containers?

930


Is stl open source?

851


a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.

1611