Beginning C Programming for Engineers

In-Class Exercise 5-2

Write a program that reads an integer as string from the keyboard, then coverts the string to an integer and prints
it out.

Notes:


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

int main()
{
    char s[100];
    int a;

    printf("Please input an integer:");
    scanf("%99s",s);

    /* convert the string s to an integer value and store it to a */

    printf("the number is: %d\n",a)
    return 0;
}