//x^2-2x-3, x^2-2x+1, x^2+2x+3 -> Try coefficients for a,b,c respectively for these equations #include // Import Standart Input-Output Library #include // Import Math Library main() // This function (main) is where main code starts and ends { float disc, b, a, c, t0, t1, sol0, sol1; // defining float variables, notice also the semicolon end of expression printf("a: "); scanf("%f",&a); // Waiting input from user for each coefficient printf("b: "); scanf("%f",&b); // Waiting input from user for each coefficient printf("c: "); scanf("%f",&c); // Waiting input from user for each coefficient disc = (b * b - 4 * a * c); //Calculating discriminant int num_sol; //------------------------------------------------------------------- // 'if'-'else if'-'else' structure in C, notice the curly braces which determines scope of a code piece belonging to 'if', 'else if' or 'else'. // Same rule applies to 'if' or 'If'-'else'. Also same thing applies to functions, while and for loops. if (disc < 0) { num_sol = 0; // Zero solution if discriminant is negative } else if (disc>0) { num_sol=2; // Two solutions if discriminant is bigger than zero sol0=(-b-(sqrt(disc)))/(2*a); // Calculating first solution sol1=(-b+(sqrt(disc)))/(2*a); // Calculating second solution printf("Solutions: %f, %f ", sol0,sol1); // Printing the solutions } else { num_sol = 1; // Two overlapped solution into a one value sol0 = (-b)/(2*a); // Calculating the only solution printf("Solution: %f ",sol0); //Printing the solution } //--------------------------------------------------------------------- printf("Solution found: %d", num_sol); // Printing the solution number return 0; } //********************************************************************************************************************************************************** // Implementing a recursive greatest common divisor algorithm #include int gcd(int a, int b) // Defining a function, notice the curly braces and parameter definitions (first integer parameter, second integer parameter) { // If you want that 'if' or 'else if' or 'else' include just one code line below them, then don't put the curly braces,the same thing applies to loops. if (b == 0) return a; else return gcd(b, a % b); //Calling itself, 'a%b' means a mod b } main() { int x,y; printf("Enter 1st number: "); scanf("%d",&x); printf("Enter 2nd number: "); scanf("%d",&y); printf("GCD of (%d, %d): %d\n ",x,y, gcd(x, y)); return 0; } //********************************************************************************************************************************************************** // Implementing a program finding the maximum value of given numbers #include main() { int value_list[5]={3,2,60,5,7}; // Creating an array with five elements and assigning elements to it int foundmax=value_list[0]; //Defining an integer variable and assigning first element of the array to it int i; for(i=1;i<5;i++) // Defining a for loop, notice the curly braces and expressions (first assignment;condition;increment) { if (foundmax