Tuesday, 23 June 2015

WRITE A C PROGRAM TO CONVERT A STRING LIKE 123 TO AN INTEGER 123



#include<stdio.h>
main()
{
    int i;
    char str1[10];
    printf("Enter a string of numeric values : ");
    scanf("%s",str1);
    i=atoi(str1);
    printf("\n The result is %d",i);
}


OUTPUT
Enter a string of numeric value : 123
the result is 123