Question

In C programming: Find the First number greater than 1000 that is divisible by 73. By...

In C programming:

Find the First number greater than 1000 that is divisible by 73. By using both solutions:

Solution 1: Start num at 1001 and loop while NOT divisible by 73.

Solution 2: Start num at 73 and loop by 73 until num > 1000.

I need a total of two programs in C language using both scenarios.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
=================================

1)

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int main() {
  
//Declaring variables
int num=1001;
  
   //This loop will display the first number divisible by 73 and is >1000
   while(1)
   {
       if(num%73==0)
       {
       printf("%d",num);
       break;  
       }
       else
       {
           num++;
       }
      
       }
   return 0;
  
}

==========================

output:

=============================

2)

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int main() {
  
//Declaring variables
int num=73;
  
   //This loop will display the first number divisible by 73 and is >1000
   while(1)
   {
       if(num>1000)
       {
       printf("Number >1000 and is divisible by 73 is %d",num);
       break;  
       }
       else
       {
           num+=73;
       }
      
       }
   return 0;
  
}

=============================

Output:

=====================Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
In C programming: Find the First number greater than 1000 that is divisible by 73. By...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ programming by Malik D. S. 7th edition 5-1: Programs model life programs are models of...

    C++ programming by Malik D. S. 7th edition 5-1: Programs model life programs are models of processes that occur in life. iteration is no exception. look around and find examples of looping processes that you encounter outside of your programming class. for examples, consider the instructions on the back of your shampoo bottle. lather, rinse, repeat. or consider the instructions on the back of the cake mix box: stir 100 times or until batter is smooth. what other examples of...

  • In ASCII C programming write a function that determines if an integer is prime. A prime...

    In ASCII C programming write a function that determines if an integer is prime. A prime number is one that is not divisible by any number other than one and itself. int isPrime(long num); Return 1 if num is prime, 0 if not. As above, make this a pure function contained in its own file isPrime.c and test it with a separate tester program. To test if an integer is prime you could implement a loop that generates trial divisors...

  • In C++ Programming, Try using loops only. This lab demonstrates the use of the While Loop...

    In C++ Programming, Try using loops only. This lab demonstrates the use of the While Loop and the Do While Loop as error checking mechanisms. You will be using each of these loops to solve the same problem. Please put them both in the same program. When you test the code, you will not see a difference in the way they execute - but there will be a difference in the logic when writing the code. You will want to...

  • In c# create a program that generates a random number from 1 to 1000. Then, ask...

    In c# create a program that generates a random number from 1 to 1000. Then, ask the user to guess the random number. If the user's guess is too high, then the program should print "Too High, Try again". If the user's guess is too low, then the program should print "Too low, Try again". Use a loop to allow the user to keep entering guesses until they guess the random number correctly. Once they figure it, congratulate the user....

  • Write a computer program that prompts the user for one number, n for the number of...

    Write a computer program that prompts the user for one number, n for the number of items in the array to sort, and create and sort 1000 different arrays of this size timing the run to get an average time to sort an array of this size. Then do the following: Initiate a variable running_time to 0 Create a for loop that iterates 1000 times. In the body of the loop, Create an array of n random integers (Make sure...

  • Programming language: C NOT c++ Problem 2 (20 points) Both the for loop and the do-while...

    Programming language: C NOT c++ Problem 2 (20 points) Both the for loop and the do-while loop can be transformed into a simple while loop. For each of the following examples a) and b), write equivalent code using a while loop instead. double rand_double)( double ret - (double)rand(); return ret/ (RAND MAX 1); int factorial (int n) int for i, ret =1; (i=2; i <= ret *= 1; n; i++) int sample_geometric_rv(double p)l double q return ret; int ne; do...

  • I am trying to create tkinter GUI for guess a number game.I am not able to...

    I am trying to create tkinter GUI for guess a number game.I am not able to complete it .Could someone guide me to complete.I am so confused about using tkinter in while loop . Below code is not working correctly .Could someone please help with this ? def get_binary_digits(dividend): binary_digits = [] while dividend != 0: quot = dividend // 2 remainder = dividend % 2 binary_digits.append(remainder) dividend = quot # The quotient becomes the new dividend. binary_digits.reverse() return binary_digits...

  • Give the solution using Python programming for following with explanations: a. Take two numbers and display...

    Give the solution using Python programming for following with explanations: a. Take two numbers and display which number is positive and which number is negative. b. Take two numbers divide and display quotient and reminder. c. Take two numbers and check if they are same or not same. a. Write four differences between high level language and low level language? b. Write all the rules of naming any variables in python and provide at least one example for each rule?...

  • **Using C Language** Get a number from the user and use that number for loops and...

    **Using C Language** Get a number from the user and use that number for loops and to make some calculations. Get a number from the user (n) (For example if the user enters a 3, each loop below will repeat 3 times) //ask, get, and return an integer (by reference) void GetIntPointer(int *numPtr); //input: the number entered by the user (pass by copy) //Calculates the product of the first (n)numbers using a while loop and store the result in *productPtr...

  • it's in C programming language 3. Write a program to find out if the first two...

    it's in C programming language 3. Write a program to find out if the first two bits of an input hex number is 11and will print "the first two bits are ones" 4- Write a program that will perform the following: Check the first two numbers of an input data if they are 11 and will print "open door 1" if so, otherwise Check the last two bits of that number if they are 11 and print" Open door 2...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT