100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
NOS 120 Final All Sets With Complete Solutions 2024/2025 $13.99   Add to cart

Exam (elaborations)

NOS 120 Final All Sets With Complete Solutions 2024/2025

 5 views  0 purchase
  • Course
  • NOS 120
  • Institution
  • NOS 120

NOS 120 Final All Sets With Complete Solutions 2024/2025

Preview 4 out of 107  pages

  • October 16, 2024
  • 107
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • NOS 120
  • NOS 120
avatar-seller
Schoolflix
NOS 120 Final All Sets With Complete Solutions
2024/2025


Write a C program called fedora.c that displays the line "Fedora is a version of Linux." ANS✔✔ #include <stdio.h>

int main()

{

printf("Fedora is a version of Linux.\n");

}



Create a simple C program which declares the variable number as a local variable that is an integer. ANS✔✔ int number;

int main()

{

}



Modify the rain.c program you created in this chapter so that the total of all inches of rain when added together is

136 inches. ANS✔✔ #include <stdio.h>

int main()

{

int rain, total_rain = 0;

for (rain = 0; rain < 17; rain++)

{

printf("We have had %d inches of rain.\n", rain);

total_rain = total_rain + rain;

}

printf("We have had a total ");

,printf("of %d inches of rain.\n", total_rain);

}



Write a program in which a prompt asks for your first name and after you enter your first name the program displays

it. ANS✔✔ #include <stdio.h>

int main()

{

char string[20];

printf("\nEnter your first name: ");

scanf("%s", string);

printf("Your first name is: %s\n", string);

}



Write a program in which you enter a number and the program calculates and displays that number cubed. ANS✔✔
#include <stdio.h>

int main(void)

{

int num, cube;

printf("\nEnter the number to cube: ");

scanf("%d", &num);

cube = num*num*num;

printf("Your number cubed is: %d\n", cube);

}



Create a program that enables you to input a positive integer and that will then tell you if it is a prime number or if it can
be

divided by 2. ANS✔✔ #include <stdio.h>

int main (void)

{

,int num;

int count;

int signal;

printf("Enter the number to test: ");

scanf("%d", &num);

for (count=2, signal=1; (count<=(num/2)) && signal; )

{

if ((num % count) ==0)

signal = 0;

else

count++;

}

if (signal)

printf("%d is prime\n", num);

else

printf("%d has %d as a factor\n", num, count);

}



Create a program in which the user enters the outside temperature in Fahrenheit. If the temperature is 60 or over,

print a comment that states "It is just fine outside." If the temperature is under 60, print a comment that states "It's

not so warm outside." ANS✔✔ #include<stdio.h>

int main (void)

{

int temp;

printf("\nEnter the outside temperature: ");

scanf("%d", &temp);

if (temp >=60)

{

, printf("It is just fine outside.\n");

}

else

{

printf("It's not so warm outside.\n");

}

}



Write a small C++ program that writes to the screen the make and model of the car or bicycle you own (or one that

you wish to own) ANS✔✔ #include <iostream>

using namespace std;

int main(void)

{

cout << "I own a Trek mountain bike.\n";

cout << "It was made in 2004.\n";

}



Rewrite the C program keyboard.c that you created earlier in this chapter to compile as a C++ program. ANS✔✔
#include<iostream>

using namespace std;

int main(void)

{

char string[50];

float my_money;

int weight;

cout << "\nEnter your First Name: ";

cin >> string;

cout << "\nEnter your Desired Monthly Income: ";

cin >> my_money;

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Schoolflix. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $13.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79223 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$13.99
  • (0)
  Add to cart