
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Consider the following
What does this program do? Rewrite the code, organizing it using sound principles.
Include comments and redo variable names and indentation.
#include<stdio.h>
main()
{
int a,b,c,d;
a=0;
while(1) {
printf("%d\n",a);
printf("input?");
scanf("%d",&c);
if(c==0) break;
d=0;
for(b=1;b<=c;b++)
if(c%b =0)d++;
if(d==2 || c==1) a=a+c
}
}
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- int a = 5; int b = 6; int nain(void){ printf("%d Xd \n", a, b); int a; printf("d Xd \n", a, b); return e; When this program runs it prints (at least using gcc -std=c99 program.c -o program on Vera Virtual). 5 6; e 6; This shows that the compiler implements the second int a; by initializing the local variable a to zero. Now consider this program: int a = 5; int b = 6; int nain(void){ int a-a + b; printf("d Xd \n", a, b); return e; When this second program runs it prints, perhaps surprisingly: 6 6; Based on the first program, which a (local or global) is being used to compute a + b ? Finally, consider this third program: int a = 6; int b = 5; int nain(void){ b = a + a; a = b + b; int a = a + b; int b= a - b; printf("d\n", a + b); return e; Activate Windows What integer does this third program print to the console? (at least using gcc -std=c99 program.c -oarrow_forwardint main() { << "Hello World!"; return 0; } Homework Exercise 1: How to Insert the missing part of the code below to output "Hello World!". How to include any additional header files that are needed. Exercise 2: How to Insert a new line after "Hello World", by using a special character How to include any additional header files that are needed. Fix any existing code (HINT: we are NOT using "using namespace std") ● ● ● ● int main() { cout << "Hello World! "; cout << "I am learning C++"; return 0; Exercise 3: Comments in C++ are written with special characters. Insert the missing parts: How to Make this a single-line comment And Make this a multi-line comment Exercise 4: How to Create a C++ program that will output your full name on one line, and your (Full name is Zaman Tonmy and college major is Computer Engineering Technology)college major on another line. How to create a multi-line comment in program and within this multi-line commentarrow_forwardRewrite the program with a little bit of changes in the codesarrow_forward
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education