Preview

Jim’s C Programming Problems

Powerful Essays
Open Document
Open Document
3249 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Jim’s C Programming Problems
Jim’s
C Programming Problems

The First 100
(currently up to 74)

gcc –ansi -Wall

A Varied Collection of Problems for Beginning Students

Version 1.0

Last Updated – January 3, 2008

Problem 1: Hello World

Write a C program that prints out the message Hello World.

Problem 2: The Value 6

Write a C program that prints out the value 6. I want you to use the %d format code.

Problem 3: The Character P

Write a C program that prints out the single character P. I want you to use the %c format code.

Problem 4: The scanf Function

Write a C program that reads in an integer value from the keyboard via the scanf function and then prints it back onto the screen. By now you should know that scanf seeks an address expression. For example, &n is an address expression.

Problem 5: Sum of Two Values

Write a C program that reads two integer values from the keyboard via the scanf function, then adds them together, stores the result into a variable called sum, and then prints out the value of the variable sum.

Problem 6: The fscanf Function

Create file called testdata6 that has a single integer value stored into it.
Write a C program that opens a file named testdata6, reads the single value stored in it using the fscanf function, and then prints the value back onto the screen. You should call the function fclose before you return to the Unix operating system.

Problem 7: Bigger than 100?

Write a C program that reads a number from the keyboard via the scanf function, and then prints the message The number is bigger than 100 if it is. If the number is 100 or less than 100 then you should print out the message The number is not bigger than 100.

Problem 8: One Line of Asterisks

Create a file called testdata8 that has a single integer value stored into it. The integer will be a number between 1 and 30 inclusive. Create a C program that uses the fscanf function to read in this integer value and then prints a line containing

You May Also Find These Documents Helpful

  • Satisfactory Essays

    unit 3

    • 313 Words
    • 2 Pages

    7. Write a pseudocode statement that assigns the value of 27 to the variable count.…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    a1 script win213

    • 380 Words
    • 2 Pages

    If the user does not enter a numeric value the program should prompt for a numeric value…

    • 380 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    12. The STO→ button stores numbers to variables. To evaluate the expression23 4 a c b + −, press 9 STO→ ALPHA MATH ENTER to store the number 9 to A. Repeat this same process if B = 2 and C = 1, then evaluate the expression by…

    • 641 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    unit 8 homework

    • 793 Words
    • 5 Pages

    4. Design a loop that asks the user to enter a number. The loop should iterate 10 times and keep a running total of the numbers entered.…

    • 793 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Assignment

    • 1058 Words
    • 5 Pages

    2) Design a Do-While loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user if he or she wishes to perform the operation again. If so, the loop should repeat, otherwise it should terminate…

    • 1058 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Nt1310 Unit 3 Assignment

    • 256 Words
    • 2 Pages

    Write a program to input a string and then display it in Upper Case and also print the frequency of any character from the string.…

    • 256 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    cout << "You are in factorial program of C++. Please enter a +ve integer:- ";…

    • 426 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Comp 122 Week 1 Ilab

    • 662 Words
    • 3 Pages

    4. Identify two test cases, one using whole number values, and one using decimal number values. For each of the two test cases show what inputs you will use and what your expected outputs should be.…

    • 662 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Programming Logic

    • 1499 Words
    • 6 Pages

    2. Design the logic for a program that outputs every number from 1 through 10.…

    • 1499 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    a. The time in hours, minutes, and seconds is to be passed to a function named totsec().…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Comp122 Week 2 Homework

    • 301 Words
    • 2 Pages

    What values (if any) are assigned to x, y, and ch after each of these statements execute?…

    • 301 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    18.Write a program to read a hex input and display it in binary. Page: 133…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    System.out.println("i = " + i + " f = " + f + " d = " + d);…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    CS305 Final Exam Questions

    • 1044 Words
    • 6 Pages

    c. It increments the stack pointer (by 2 or 4) and copies the operand into the stack at the location pointed to by the stack pointer.…

    • 1044 Words
    • 6 Pages
    Satisfactory Essays
  • Good Essays

    Unit 16 Ao1

    • 529 Words
    • 3 Pages

    Programs need to store data at some time during the execution of processes. Data is held in variables which are names containers for each piece of data. Each variable must be given a name so it can be referred to again and again throughout the program. It should be something that is recognisable because for example variable 1 would be soon forgotten in a substantial piece of code. Variable names cannot be the same as code words such as print or run.…

    • 529 Words
    • 3 Pages
    Good Essays

Related Topics