Popular posts from this blog
C Program to print swap number using third variables
C Program to print swap number using third variables #include<stdio.h> #include <conio.h> void main() { int a, b, temp; printf("Enter first number: "); scanf("%d", &a); printf("Enter second number: "); scanf("%d", &b); temp = a; a = b; b = temp; printf("\nAfter swapping first number = %d\n", a); printf("After swapping second number = %d", b); getch(); } Output: Enter first number: 8 Enter second number: 10 After swapping first number = 10 After swapping second number = 8 C
C Program to open and write to a text file using fprintf.
C Program to open and write to a text file using fprintf. #include <stdio.h> #include <conio.h> #include <stdlib.h> void main() { int number; FILE *fileptr; fileptr = fopen("D:\\program.txt","w"); if( fileptr == NULL) { printf("Error in file !"); exit(1); } printf("Enter number: "); scanf("%d",&number); fprintf( "fileptr %d",number); fclose( fileptr ); getch(); }
Comments
Post a Comment