1. Question:Write a c program to know the last date of modification of any file 

    Answer
    #include "time.h"
    #include "sys\stat.h"
    #include "stdio.h"
    int main(){
        struct stat status;
        FILE *fp;
        fp=fopen("test.txt","r");
        fstat(fileno(fp),&status);
        
        printf("Last date of modification : %s",ctime(&status.st_ctime));
        return 0;
    }






    1. Report
  2. Question:Write a c program to find out the size and drive where file has stored of any given file? 

    Answer
    #include "time.h"
    #include "sys\stat.h"
    #include "stdio.h"
    int main(){
        struct stat status;
        FILE *fp;
        fp=fopen("test.txt","r");
        fstat(fileno(fp),&status);
        printf("Size of file : %d",status.st_size);
        printf("Drive name   : %c",65+status.st_dev);
        return 0;
    }






    1. Report
  3. Question:How to use complex numbers in c 

    Answer
    #include<stdio.h>
    int main(){
    int a,b;
    
    printf("Enter any complex number in the format a+ib: ");
    scanf("%d+i%d",&a,&b);
    
    printf("Real part is: %d",a );
    printf("\nImaginary part is: %d",b);
    
    return 0;
    
    }






    1. Report
  4. Question:C program to printf complex numbers 

    Answer
    #include<stdio.h>
    int main(){
    int a,b;
    
    printf("Enter the real part of complex number: ");
    scanf("%d",&a);
    
    printf("Enter the imaginary part of complex number: ");
    scanf("%d",&b);
    
    printf("\nComplex number is: %d%+di",a,b );
    
    return 0;
    
    }






    1. Report
  5. Question:C program to add two complex numbers 

    Answer
    #include<stdio.h>
    int main(){
      int a,b,c,d,x,y;
      printf("\nEnter the first complex number:");
      scanf("%d%d",&a,&b);
      printf("\nEnter the second complex number:");
      scanf("%d%d",&c,&d);
      if(b<0)
          printf("%d-i\n",a-b);
      else
          printf("d+i\n",a+b);
      if(d<0)
          printf("d-i\n",c-d);
      else
          printf("%d+i\n",c+d);
      printf("\nADDITION ");
      x=a+c;
      y=b+d;
      if(y>0)
          printf("%d-i%d",x,-y);
      else
          printf("%d+i%d",x,+y);
      printf("\n\nSUBTRACTION ");
      x=a-c;
      y=b-d;
      if(y<0)
          printf("%d-i%d",x,-y);
      else
          printf("%d+i%d",x,+y);
      return 0;
    }






    1. Report
Copyright © 2025. Powered by Intellect Software Ltd