write a program that input four digit number and find how
many 7 that number contains
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int num,n,i=0,p;
printf("\nEnter the number ");
scanf("%d",&num);
while(num>0)
{
n=num%10;
p=num/10;
num=p;
if(n==7)
{
i++;
}
}
printf("\nthe total number of occurence of the digit 7
is %d",i);
getch();
}
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / kumar
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str;
cout << "Enter a 4 digit number with '7' in it:";
cin >> str;
str.resize(4);
cout << "The 4 digit numebr you have entered is:" << str
<<endl;
int ipos = 0, count =0;
ipos = str.find_first_of('7');
while (ipos!=-1)
{
count ++;
ipos = str.find_first_of('7',(ipos+1));
}
if (count)
cout <<"Number of '7' in the string: "<<count<<endl;
else
cout <<"There are no 7's in the string entered"<<endl;
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / gundaraj
void main()
{
int a[4],i,count=0;
cout<<"enter 4 digit number";
for(i=0;i<=3;i++)
{
cin>>a[i];
if(a[i]==7)
count++;
}
cout<<"The number of 7's are "<<count;
}
Is This Answer Correct ? | 1 Yes | 4 No |
Explain stl.
What do stl stand for?
5. Write c++ function that would intake a string and return the number of occurrences of a given character in that sring Ex:- if the word is “Colombo” and count the occurrences of the letter “o” the function would return 3
Explain how to insert a hyperlink in to an Excel worksheet and save a Word document as a Web page.
What is 2*2?
Is stl part of c++ standard?
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
What is a stl vector?
What is a list in c++ stl?
What are the various types of stl containers?
what is the acronym of the term 'C.O.M.P.U.T.E.R' ?
17 Answers Config Systems, Google, Wipro,
Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A.Explain how a pointer to function can be declared in C++? B.List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header (“Include”) Files.
0 Answers GE, Infosys, Microsoft, NIM,