More Programs On Strings Write a program to accept a string and print the string in lower case in C language #include<stdio.h> #include<conio.h> #include<string.h> main() { char *s1; clrscr(); printf("Enter string: "); scanf("%s",s1); printf("String in lower…Prashant ChaudhariSeptember 18, 2012
More Programs On Strings Write a program to accept a string and print the string in upper case in C language #include<stdio.h> #include<conio.h> #include<string.h> main() { char *s1; clrscr(); printf("Enter string:"); scanf("%s",s1); printf("String in UPPER CASE…Prashant ChaudhariSeptember 18, 2012
More Programs On Strings Write a program to accept a string and copy it into another string in C language #include<stdio.h> #include<conio.h> #include<string.h> main() { char *s1,*s2; clrscr(); printf("Enter string 1 : "); scanf("%s",s1); strcpy(s2,s1);…Prashant ChaudhariSeptember 18, 2012
More Programs On Strings Write a program to calculate lenght of a given string in C language #include<stdio.h> #include<conio.h> #include<string.h> main() { char *s1; clrscr(); printf("Enter string : "); scanf("%s",s1); printf("Lenght: %d",strlen(s1));…Prashant ChaudhariSeptember 18, 2012
More Programs On Strings Write a program to accept a string and print the string in reverse order in C language #include<stdio.h> #include<conio.h> #include<string.h> main() { char *s1; clrscr(); printf("Enter string : "); scanf("%s",s1); printf("Reverse String…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On Command Line ArgumentsResources 101. Write a program accept a file name from user and print content of that file #include<stdio.h> int main(int argc, char *argv[]) { if ( argc != 2 ){ printf( "usage:…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On File OperationsResources 100. Merge two files by store data into third one #include<stdio.h> #include<stdlib.h> int main() { FILE *fp1 = fopen("file1.txt", "r"); FILE *fp2 = fopen("file2.txt", "r");…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On File OperationsResources 099. Write a program to read and write a file line by line. #include<stdio.h> int main() { FILE *fp; char str; fp = fopen("C:\\myfile.txt", "w"); if (fp ==…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On File OperationsResources 098. Write a program to read and write a file character by character. #include<stdio.h> int main() { FILE *fp; /* file pointer*/ char fName; char ch; printf("\nEnter file…Prashant ChaudhariSeptember 18, 2012
Learn C ProgrammingLearn ProgrammingPrograms On StructuresResources 097. Define a structure Employee having elements emp_id, name, DOB, DOJ etc. Accept data and reprint it. (use structure within structure) #include<stdio.h> #include<conio.h> struct Date { int mm,dd,yy; }; struct Employee { char name; int emp_id;…Prashant ChaudhariSeptember 18, 2012