Menu
Coddy logo textTech

Challenge #3

Lesson 23 of 23 in Coddy's C++ File Handling course.

challenge icon

Challenge

Easy

Write a program that will read input from the file input.txt, you'll be given 5 numbers, for each of those numbers calculate the number of divisors they have and write them separated with a whitespace in the output file output.txt.

Input
5 7 10 8 12

Output
2 2 4 4 6

Try it yourself

#include <iostream>
#include <fstream>

using namespace std;

int main() 
{
    
    // Enter your code here
    
    
    
    // DO NOT CHANGE THE CODE BELOW!
    ifstream file("output.txt")
    string line;
    getline(file, line);
    cout << line;
    file.close()
}

All lessons in C++ File Handling