Thread: Who can check my code?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2021
    Posts
    4

    Who can check my code?

    //My program working but i don't know, i did it in correct way or not.?
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>
    
    
    struct triagle
    {
        float point1;
        float point2;
        float point3;
    };
    
    
    float tr_perimetr(float x,float y,float z)
    {   
        float perimetr;
        perimetr = x+y+z;
        
        return perimetr;
    }
    
    
    
    
    int main()
    {   
        srand(time(NULL));
        struct triagle perimetr;
        int num;
        perimetr.point1 = (rand()/(float)RAND_MAX)*(10.0+10.0)-10.0;
        perimetr.point2 = (rand()/(float)RAND_MAX)*(10.0+10.0)-10.0;
        perimetr.point3 = (rand()/(float)RAND_MAX)*(10.0+10.0)-10.0;
        printf("Perimetr of triangle with edges of %.1f\t%.1f and %.1f = %.1f",perimetr.point1,perimetr.point2,perimetr.point3,tr_perimetr(perimetr.point1,perimetr.point2,perimetr.point3));
        
        
        return 0;
    }
    Attached Images Attached Images Who can check my code?-xaldu-jpg 

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. check my code
    By senkuu in forum C Programming
    Replies: 1
    Last Post: 09-14-2016, 09:02 AM
  2. Help! Check my code over.
    By omGeeK in forum C Programming
    Replies: 6
    Last Post: 11-04-2010, 11:34 PM
  3. check my c code.
    By rfm in forum C Programming
    Replies: 4
    Last Post: 09-24-2009, 05:47 AM
  4. Check out my code
    By joshdick in forum C++ Programming
    Replies: 9
    Last Post: 09-17-2003, 07:41 PM
  5. check the code
    By pasha in forum Windows Programming
    Replies: 2
    Last Post: 01-06-2003, 02:01 PM

Tags for this Thread