Program 3 - third.c

#include <stdio.h>

void main()
{
            /*   Initialize variables   */
            float radius;
            char yourName[15];
            int number;

            /*   Input   */
            printf("Enter the radius of circle: ");
            scanf("%f",&radius);    
            printf("Enter a number from 1 to 1000: ");
            scanf("%d",&number);
            printf("Enter your first name: ");
            scanf("%s",&yourName);

            /*   Writes to file ThirdProgram.txt   */
            FILE * qFile;
            qFile = fopen ("ThirdProgram.txt","w");
            fprintf (qFile,"The following information was generated by program Third.exe.\n\n");
            fprintf (qFile,"Hello %s.\n",yourName,radius);
            fprintf (qFile,"Your circle of radius %f has an area of %f.\n",radius,3.14*radius*radius);
            fprintf (qFile,"Your number was %d.\n\n",number);
}


Site Map Email the SMA