1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bulgar [2K]
2 years ago
7

Write a program that asks the user for a positive integer value. The program should use a loop to get the sum of all even intege

rs from 0 up to the number entered, and then display the sum. For example, if the user enters 11, the loop will find the sum of 2, 4, 6, 8, and 10. Input validation: Do not accept a negative number or 0 from user input
Computers and Technology
1 answer:
lapo4ka [179]2 years ago
5 0

import java.io.*;

public class GFG {

   // Returns true if s is

   // a number else false

   static boolean isNumber(String s)

   {

       for (int i = 0; i < s.length(); i++)

           if (Character.isDigit(s.charAt(i)) == false)

               return false;

       return true;

   }

   // Driver code

   static public void main(String[] args)

   {

       // Saving the input in a string

       String str = "6790";

       // Function returns 1 if all elements

       // are in range '0 - 9'

       if (isNumber(str))

           System.out.println("Integer");

       // Function returns 0 if the

       // input is not an integer

       else

           System.out.println("String");

   }

}

You might be interested in
What is an example of new technology having a positive impact on sustainability?
kolezko [41]

Answer:

The main technology that brings positive news on sustainability in any company would be the use of renewable technology more because we can use energy. For example, by using equipment such as solar panels, windmills or water turbines, we can generate electricity and use it many times.

3 0
1 year ago
in an advertisement is made of a wireless keyboard and a mouse.Name two commonly used methods of connecting devices wirelessly​
DENIUS [597]

Answer:

Wireless LAN

Wireless MAN

Explanation:

I use these methods to connect my wireless devices all of the time and most of my friends do it as well so I am pretty sure it is a commonly used method.

3 0
3 years ago
Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to kee
Tju [1.3M]

Answer:

Yahoo! mail

Explanation:

In the context, Dona travels most often around the world. While traveling, she has to access her emails from different location and at different times. But in order to keep her luggage light, she never carries the laptop with her. Therefore, Donna uses Yahoo! mail to access her emails.

Donna uses Yahoo mail because she can install the Yahoo! mail app in her phone or tablets which is small in size and of light weight. She is able to organize her Outlooks,  Google mails and  Yahoo accounts. In Yahoo! mail, Donna is also able to sign in with her any of the non yahoo accounts and it also provides free cloud storage space.

8 0
3 years ago
Read 2 more answers
LAB: Count characters - methods
tangare [24]

Answer:

i hope understand you

mark me brainlist

Explanation:

using namespace std;

#include <iostream>

 

#include <string.h>

#include <stdlib.h>

#include <stdio.h>

 

#define BLANK_CHAR (' ')

 

 

int CountCharacters(char userChar, char * userString)

{

 

int countReturn=0;

 

int n = strlen(userString);

 

for (int iLoop=0; iLoop<n; iLoop++)

{

       if (userString[iLoop]==userChar)

       {

        countReturn++;

 }

}

return(countReturn);

}

 

/******************************************

    Removes white spaces from passed string; returns pointer

     to the string that is stripped of the whitespace chars;

   

  Returns NULL pointer is empty string is passed;  

     Side Effects:

 CALLER MUST FREE THE OUTPUT BUFFER that is returned

 

 **********************************************************/

char * RemoveSpaces(char * userString)

{

 

 char * outbuff = NULL;

 

 if (userString!=NULL)

 {

   int n = strlen(userString);

    outbuff = (char *) malloc(n);

 

   if (outbuff != NULL)

   {

          memset(outbuff,0,n);

          int iIndex=0;

          //copies non-blank chars to outbuff

         for (int iLoop=0; iLoop<n; iLoop++)

         {

           if (userString[iLoop]!=BLANK_CHAR)

          {

           outbuff[iIndex]=userString[iLoop];

           iIndex++;

   }

   

   } //for

         

   }

   

   }

 return(outbuff);

 

}

 

 

int main()

{

 

 char inbuff[255];

 cout << " PLEASE INPUT THE STRING OF WHICH YOU WOULD LIKE TO STRIP WHITESPACE CHARS :>";

 gets(inbuff);

 

 char * outbuff = RemoveSpaces(inbuff);

 if (outbuff !=NULL)

 {

    cout << ">" << outbuff << "<" << endl;

    free(outbuff);

    }

     

   memset(inbuff,0,255);  

   cout << " PLEASE INPUT THE STRING IN WHICH YOU WOULD LIKE TO SEARCH CHAR :>";

gets(inbuff);

 

  char chChar;

 cout << "PLEASE INPUT THE CHARCTER YOU SEEK :>";

 cin >> chChar;

 

 int iCount = CountCharacters(chChar,inbuff);

 cout << " char " << chChar << " appears " << iCount << " time(s) in >" << inbuff << "<" << endl;

 

}

4 0
3 years ago
Sarah is having a hard time finding a template for her advertising buisness that she mah be able to use at a later date and also
irinina [24]

Answer: create a custom template

Explanation:

Since Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later date and also make it available to her colleagues, her best option will be to create a custom template.

Creating a custom template will ensure that she makes the template based on her requirements and can tailor it specifically to her needs which then makes it unique.

6 0
3 years ago
Other questions:
  • Using the CPI to calculate the inflation rate​ _______________ the underlying inflation​ rate, and using the core inflation rate
    7·2 answers
  • Rapid development programming languages eliminate the possibility of having bugs in code. True or False
    8·1 answer
  • The main workplace of a Windows computer is called the
    14·1 answer
  • You want to establish the validity of a test designed for computer technicians using a predictive criterion-related validation s
    9·1 answer
  • I want to discard my old computer and want to securely erase the data from my hard drive what is the process called.
    14·2 answers
  • What two benefits are a result of configuring a wireless mesh network? Check all that apply.
    12·1 answer
  • Nhiệt độ chiết rót của máy chiết rót có van trượt là bao nhiêu
    6·1 answer
  • "If possible, always bring print-outs of your slides for your audience
    7·2 answers
  • Python Question Class 11 attached below
    9·1 answer
  • Which of the following terms means the computer operating system automatically detects and installs the proper driver for a new
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!