SlideShare a Scribd company logo
1 of 3
https://tests.mettl.com/authenticateKey/87c41143
https://tests.mettl.com/authenticateKey/ed6b4da
https://tests.mettl.com/authenticateKey/ab1d60cc
https://tests.mettl.com/authenticateKey/b55d1714
https://tests.mettl.com/authenticateKey/738fdee0
https://tests.mettl.com/authenticateKey/738fdee0
https://tests.mettl.com/authenticateKey/a05abbcf
The Question- Number of Prime numbers in a specified range
Write a function to the count of the number of prime numbers in a specified range. The starting
and ending number of the range will be provided as input parameters to the function.
Assumption: 2 is less than or equal to starting number of the range is less than or equal to
ending number of the range is less than or equal to 7919.
Example1: If the starting and ending number of the range is given as 2 and 20, the method must
return 8, because there are 8 prime numbers in the specified range from 2 to 20, namely (2, 3, 5,
7, 11, 13, 17, 19).
Exapmle2: If the starting and ending number of the range is given as 700 and 725, the method
must return 3, because there are 3 prime numbers in the specified range from 700 to 725,
namely (701, 709, 719).
int k = 0, count =0;
while(input1 <= input2)
{
for(int i=2;i<input1;i++)
{
if(input1%i == 0)
{
k++;
}
}
if(k == 0)
{
count++;
}
input1++;
k =0;
}
return count;
}
}
The Question- All Digits Count Write a function to find the count of ALL digits in a given number
N.
The number will be passed to the function as an input parameter of type int. Assumption: The
input number will be positive integer number is greater than or equal to 1 and is less than or
equal to 25000.
For e.g. - If the given number is 292, the function should return 3 because there are 3 digits in
this number. –
If the given number is 1015, the function should return 4 because there are 4 digits in this
number.
int count = 0;
while (input1 != 0)
{
input1 /= 10;
count++;
}
return count;
}
}
Mettl prg

More Related Content

What's hot

Functions & Procedures [7]
Functions & Procedures [7]Functions & Procedures [7]
Functions & Procedures [7]
ecko_disasterz
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4
emailharmeet
 
Call by value
Call by valueCall by value
Call by value
Dharani G
 
Lecture 3 c++
Lecture 3 c++Lecture 3 c++
Lecture 3 c++
emailharmeet
 

What's hot (20)

CS151 Functions lecture
CS151 Functions lectureCS151 Functions lecture
CS151 Functions lecture
 
Practical no 1
Practical no 1Practical no 1
Practical no 1
 
Task python
Task pythonTask python
Task python
 
Functions & Procedures [7]
Functions & Procedures [7]Functions & Procedures [7]
Functions & Procedures [7]
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4
 
Programming qns
Programming qnsProgramming qns
Programming qns
 
Call by value
Call by valueCall by value
Call by value
 
7. Pointer Arithmetic
7. Pointer Arithmetic7. Pointer Arithmetic
7. Pointer Arithmetic
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
Concept of c
Concept of cConcept of c
Concept of c
 
Expression evaluation
Expression evaluationExpression evaluation
Expression evaluation
 
Prefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsPrefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix Notations
 
A simple program C# program
A simple program C# programA simple program C# program
A simple program C# program
 
Python operators part2
Python operators part2Python operators part2
Python operators part2
 
Lecture 3 c++
Lecture 3 c++Lecture 3 c++
Lecture 3 c++
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
c++ programming Unit 4 operators
c++ programming Unit 4 operatorsc++ programming Unit 4 operators
c++ programming Unit 4 operators
 
Microprocessor-based Systems 48/32bit Division Algorithm
Microprocessor-based Systems 48/32bit Division AlgorithmMicroprocessor-based Systems 48/32bit Division Algorithm
Microprocessor-based Systems 48/32bit Division Algorithm
 
Practical no 4
Practical no 4Practical no 4
Practical no 4
 
Activities on Software Development
Activities on Software DevelopmentActivities on Software Development
Activities on Software Development
 

Similar to Mettl prg

Virtusa questions placement preparation guide
Virtusa questions placement preparation guideVirtusa questions placement preparation guide
Virtusa questions placement preparation guide
ThalaAjith33
 
C aptitude scribd
C aptitude scribdC aptitude scribd
C aptitude scribd
Amit Kapoor
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
ankush_kumar
 

Similar to Mettl prg (20)

Reference Parameter, Passing object by reference, constant parameter & Defaul...
Reference Parameter, Passing object by reference, constant parameter & Defaul...Reference Parameter, Passing object by reference, constant parameter & Defaul...
Reference Parameter, Passing object by reference, constant parameter & Defaul...
 
Virtusa questions placement preparation guide
Virtusa questions placement preparation guideVirtusa questions placement preparation guide
Virtusa questions placement preparation guide
 
C important questions
C important questionsC important questions
C important questions
 
C aptitude scribd
C aptitude scribdC aptitude scribd
C aptitude scribd
 
Computer programming 2 Lesson 10
Computer programming 2  Lesson 10Computer programming 2  Lesson 10
Computer programming 2 Lesson 10
 
C code examples
C code examplesC code examples
C code examples
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Lecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptxLecture 5Arrays on c++ for Beginner.pptx
Lecture 5Arrays on c++ for Beginner.pptx
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine Learning
 
NPTEL QUIZ.docx
NPTEL QUIZ.docxNPTEL QUIZ.docx
NPTEL QUIZ.docx
 
Lecture4
Lecture4Lecture4
Lecture4
 
Unit 6 pointers
Unit 6   pointersUnit 6   pointers
Unit 6 pointers
 
Advanced C - Part 2
Advanced C - Part 2Advanced C - Part 2
Advanced C - Part 2
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
Qno 3 (a)
Qno 3 (a)Qno 3 (a)
Qno 3 (a)
 
Lec21-CS110 Computational Engineering
Lec21-CS110 Computational EngineeringLec21-CS110 Computational Engineering
Lec21-CS110 Computational Engineering
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 

More from RajSingh734307 (8)

Series direction blood relation
Series direction blood relationSeries direction blood relation
Series direction blood relation
 
Nitesh singh internshalaresume
Nitesh singh internshalaresumeNitesh singh internshalaresume
Nitesh singh internshalaresume
 
Wc crypto and puzzles
Wc crypto and puzzlesWc crypto and puzzles
Wc crypto and puzzles
 
Dbms practical list
Dbms practical listDbms practical list
Dbms practical list
 
Unit3
Unit3Unit3
Unit3
 
Unit 2
Unit 2Unit 2
Unit 2
 
Cad
CadCad
Cad
 
Iare ds lecture_notes_2
Iare ds lecture_notes_2Iare ds lecture_notes_2
Iare ds lecture_notes_2
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid EnvironmentsWSO2Con2024 - Software Delivery in Hybrid Environments
WSO2Con2024 - Software Delivery in Hybrid Environments
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
 

Mettl prg

  • 1. https://tests.mettl.com/authenticateKey/87c41143 https://tests.mettl.com/authenticateKey/ed6b4da https://tests.mettl.com/authenticateKey/ab1d60cc https://tests.mettl.com/authenticateKey/b55d1714 https://tests.mettl.com/authenticateKey/738fdee0 https://tests.mettl.com/authenticateKey/738fdee0 https://tests.mettl.com/authenticateKey/a05abbcf The Question- Number of Prime numbers in a specified range Write a function to the count of the number of prime numbers in a specified range. The starting and ending number of the range will be provided as input parameters to the function. Assumption: 2 is less than or equal to starting number of the range is less than or equal to ending number of the range is less than or equal to 7919. Example1: If the starting and ending number of the range is given as 2 and 20, the method must return 8, because there are 8 prime numbers in the specified range from 2 to 20, namely (2, 3, 5, 7, 11, 13, 17, 19). Exapmle2: If the starting and ending number of the range is given as 700 and 725, the method must return 3, because there are 3 prime numbers in the specified range from 700 to 725, namely (701, 709, 719). int k = 0, count =0; while(input1 <= input2) { for(int i=2;i<input1;i++) { if(input1%i == 0) { k++; } } if(k == 0) { count++; } input1++; k =0; } return count; } }
  • 2. The Question- All Digits Count Write a function to find the count of ALL digits in a given number N. The number will be passed to the function as an input parameter of type int. Assumption: The input number will be positive integer number is greater than or equal to 1 and is less than or equal to 25000. For e.g. - If the given number is 292, the function should return 3 because there are 3 digits in this number. – If the given number is 1015, the function should return 4 because there are 4 digits in this number. int count = 0; while (input1 != 0) { input1 /= 10; count++; } return count; } }