Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main() {
- FILE *ptr;
- ptr = fopen("text.txt", "w");
- if (ptr == NULL) {
- printf("File does not exist\n");
- } else {
- char ch[50];
- gets(ch);
- fprintf(ptr, "%s", ch);
- printf("Updated!\n");
- }
- }
- // long long check(long long n) {
- // int count = 0;
- // while (n > 0) {
- // n = n / 10;
- // count++;
- // }
- // return count;
- // }
- // int main() {
- // long long number;
- // scanf("%lld", &number);
- // long long res = check(number);
- // // printf("%lld\n", res);
- // if (res == 11) {
- // printf("Condition true\n");
- // } else {
- // printf("Condition false\n");
- // }
- // }
- // struct student {
- // char name[50];
- // int roll;
- // int phoneNo;
- // };
- // int main() {
- // struct student s1[50];
- // int size;
- // printf("How many students you have?\n");
- // scanf("%d", &size);
- // for (int i = 0; i < size; i++) {
- // printf("Enter Name: \n");
- // fflush(stdin);
- // gets(s1[i].name);
- // fflush(stdout);
- // printf("Enter Roll and Phone no: \n");
- // scanf("%d %d", &s1[i].roll, &s1[i].phoneNo);
- // }
- // for (int i = 0; i < size; i++) {
- // printf("Name: %s\n", s1[i].name);
- // printf("Roll: %d\n", s1[i].roll);
- // printf("Phone No: %d\n", s1[i].phoneNo);
- // }
- // }
- // int main() {
- // struct student s1;
- // gets(s1.name);
- // scanf("%d %d", &s1.roll, &s1.phoneNo);
- // printf("Name: %s\nRoll: %d\nPhone No: %d\n", s1.name, s1.roll, s1.phoneNo);
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement