C/C++ :: 100 To 1000 Divisible By 5 And 6

Oct 2, 2014

Write a program that displays all the numbers from 100 to 1,000, ten per line, that are divisible by 5 and 6. Numbers are separated by exactly one space.

#include <iostream>
#include <stdlib.h>
using namespace std;

[Code]....

View 8 Replies


ADVERTISEMENT

C++ :: The Max Of N Inputs That Is Divisible By 3

Nov 29, 2013

Code:
#include <stdio.h>
int main(){
int A, B;
char decision;
printf("Do you have an integer to input? [Y/N]: ");
scanf("%c",&decision);
if(decision=='Y' || decision=='y'){

[Code]....

After entering a single integer, it doesn't scan again for another integer. What's wrong?

I'm using a mac btw, if that makes a difference with Ubuntu/Linux.

View 8 Replies View Related

C# :: Number Divisible By 6

Mar 25, 2014

Does this program solve the problem of testing an integer to be divisible by 6?

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chapter7Problem5

[Code] ....

View 2 Replies View Related

C/C++ :: Odd Numbers Divisible By N

Apr 28, 2012

How to write a program of odd numbers divisible by n

View 1 Replies View Related

C++ :: Check For Values Divisible By 5

Oct 2, 2013

#include <iostream>
using namespace std;
int main() {
int i=0;
while (i<=100) {

[Code] .....

the part where i need to check for values divisible by 5 is incomplete.

View 2 Replies View Related

C++ :: Positive Number Divisible By 10 With No Remainder

May 3, 2014

Assume you want to make sure that the user enters a positive number that is divisible by 10 with no remainder. Write the condition you would use in the following do-while loop.

do {
cout << “Enter a positive number that is divisible by 10 with no remainder” << endl;
cin >> number;
}
while ( ____________________________________________________________);

View 2 Replies View Related

C :: Determine How Many Numbers In A Range Are Divisible By Third - Loop

Mar 1, 2013

I've pretty much finished the entire program, except for the actual calculation part.

"Given a range of values determine how many integers within that range, including the end points, are multiples of a third value entered by the user. The user should be permitted to enter as many of these third values as desired and your output will be the sum of total multiples found."

I've defined functions to take user input for the low range, high range and a do-while loop to take as many third inputs as the user wants (terminated by entering -1, as requested by the question)

To actually calculate if they're divisible, I found out that if A%B = 0, then they are divisible, so I thought I would create a loop where each value in the range between A and B is checked against the third value to see if they output a zero.

What I need to end up with is a program that tells the user how many integers are divisible by the numbers in the range, i.e: "Enter the low range value: 335 Enter the high range value: 475 Enter a value to check within the range: 17 Enter a value to check within the range: -1 There are 8 total values that are divisible by the numbers in the range." Going back to my original question, how would I create a loop or something to "check" how many values are equal to zero, and consequently increment a variable for each instance? (This is how I think it should be done)

Code:

#include <stdio.h>
//GLOBAL DECLARATIONS
int getlowR();
int gethighR(int);

[Code].....

View 4 Replies View Related

C/C++ :: Program That Outputs Numbers Divisible By Two Values

May 2, 2012

A program that outputs all numbers divisible by both 5 and 6.This is what i have written :

#include<stdio.h>
int  main () { 
int i=200;
int b=10;
while(i<1000)
i b/6%==0
}

where could i have gone wrong.

View 1 Replies View Related

C++ :: Find All Prime Numbers From 1 To 1000?

Jan 9, 2013

#include<iostream>
#include <cstdlib>
using namespace std;

[Code].....

View 10 Replies View Related

C++ :: Display All Composite Numbers From 0 To 1000?

Feb 21, 2013

Create a program that will display all the composite numbers from 0 to 1000 and has a maximum column of 5 . A composite number is a positive integer that has at least one positive divisor other than one or itself. In other words a composite number is any positive integer greater than one that is not a prime number.

SAMPLE OUTPUT:

4 6 8 9 10
12 14 15 16 18
20 21 22 24 25
26 27 28 30 32
....and so on.

View 6 Replies View Related

C/C++ :: Sum Up All Numbers Between Start And End And Compare This Sum To 1000

Oct 7, 2014

Sum up all the numbers between start and end. Lastly compare this sum to 1000.

--so i got the first part, but how to compare the sum to 1000.

View 3 Replies View Related

C :: Write Text Up To 1000 Characters And Get It Back

Jun 20, 2013

I'm challenged to write a code for the following:

write a text up to 1000 characters, and get it back. the end of the text is detected though EOF on a new line or reaching 1000 characters.(EOF=ctr-Z on a new line)

I mainly have problem how to bring the EOF work probably. it doesn't react when I press ctrl-z directly?

Code:
int i;
char Text[1000];
printf("write the text:
");
gets(Text);
for(i=0;i<=1000;i++){

[Code] .....

View 3 Replies View Related

C :: Display Histogram Of 1000 Gaussian Distributed Numbers

Mar 5, 2013

I'm writing a program to display a histogram of 1000 Gaussian distributed numbers. I've generated the numbers using rand and now need to transform them. I have found the following formula to use

f(x) = exp(-x^2 / (2*sigma^2)) / sqrt(2*pi*sigma)

And I am unsure how to implement this into a function.

View 3 Replies View Related

C/C++ :: Switch Case - Show Integer Between 1 To 1000 As Words

Sep 21, 2014

I'm brand new to coding, and I'm learning C. To start, I wanted to create a program that would show an integer between 1-1000 as words (such as 157=One Hundred and Fifty Seven)

I'm having trouble with the switch-case function. I know that what I'm doing all works until it hits the switch function. I've tried switching one of the strcpy functions out with a printf, followed by a system("PAUSE") function, and it gave me results, so I know that the switch function is accepting my "hund" integer. I believe my problem lies within the strcpy function, and its use in the case function.

In short, why isn't the strcpy function working in the switch-case function? Below is my code as it is:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int num;
int hund;
char letHund[20];

[Code] .....

View 2 Replies View Related

C/C++ :: Selectively Choose Only Numbers Greater Than 1000 In Array?

Aug 4, 2013

I am doing my assignment that will calculate total tax amount per day and per week and finally sum those up.

One of the requirement is to filter out any number in the array that is less than 1000 to be assigned a value of zero instead of the stored value so as not to add it in the calculation. How to fulfill this requirement.

View 2 Replies View Related

C++ :: Add Score Between 0 And 1000 Inputted By User To Total And Increase Level

May 9, 2013

The program is supposed to have a method called Hitscore that adds a score between 0 and 1000 inputted by the user to the total score and increases level by one and print the score to the screen and which level they last completed after each entry . Have the user continue inputting scores to the program until the gamer has finished all 10 levels. After 10 levels, use a method you create called PassScore to have the program compare the score to avgscore (5000). If the score is less than avgscore, have the code respond "You are not angry at all. " if it is above avgscore, then have it respond "You seem quite angry, calm down. " and if it is exactly 5000, have it respond "Average, just average. "

//Angrybird.h
#ifndef ANGRYBIRD_H
#define ANGRYBIRD_H
using namespace std;
class Angrybird {
public:

float newscore;
float level;

[Code] .....

View 1 Replies View Related

C++ :: Convert To Int Part Of 1000 Digit Long Number Defined In Char Array

Jan 28, 2015

How do I convert just the number from position 4 to 15 from this char array and convert to int and save to variable

char numbers[]="54155444546546545643246543241465432165456";

the real char got 1000 digits this is just example how do i convert chars from numbers[4] to numbers[15] and save them as one number ? in this case i will get int x = 5444546546545643 as u can see char numbers as a example above

View 4 Replies View Related

C++ :: Display Last 1000 Lines From Multiple Text Files (log Files)

Jan 16, 2014

I am writing a piece of code that requires me to display the last 1000 lines from a multiple text files (log files). FYI, I am running on Linux and using g++.

I have a log file from which - if it contains more than 1000 lines, I need to display the last 1000 lines. However, the log file could get rotated. So, in case where the current log file contains less than 1000 lines, I have to go to older log file and display the remaining. For e.g., if log got rotated and new log file contains 20 lines, I have to display the 980 lines from old log file + 20 from current log files.

What is the best way to do this? Even an outline algorithm will work.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved