- 2

#include<stdio.h> #include<math.h> int main() { float a,b,c,s,area; printf("ENTER THE THREE SIDES OF A TRIANGLE REPECTIVELY");

Can anybody tell me the mistake in this code

17th Sep 2020, 5:37 AM
MSD
5 Answers
+ 6
Your code is looking incomplete See this #include<stdio.h> #include<math.h> int main() {   float a, b, c, s, area;   printf("Enter sides of a triangle\n");   scanf("%f%f%f", &a, &b, &c);   s = (a+b+c)/2;   area = sqrt(s*(s-a)*(s-b)*(s-c));   printf("Area of the triangle = %f\n", area);   return 0; }
17th Sep 2020, 6:05 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
Tell what u want to do with this program.
17th Sep 2020, 5:41 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
#include<stdio.h> #include<math.h> int main() { float a,b,c,s,area; printf("ENTER THE THREE SIDES OF A TRIANGLE REPECTIVELY"); return 0; }
17th Sep 2020, 5:46 AM
Alphin K Sajan
Alphin K Sajan - avatar
0
#include <stdio.h> #include <string.h> #include <math.h> int main() { float A = 0, B = 0; int width = 40, height = 12; // Console size char buffer[1760]; float zBuffer[1760]; printf("\x1b[2J"); // Clear the screen while (1) { memset(buffer, 32, 1760); // Fill buffer with spaces memset(zBuffer, 0, 7040); // Reset Z-buffer for (float theta = 0; theta < 6.28; theta += 0.07) { for (float phi = 0; phi < 6.28; phi += 0.02) { float cosA = cos(A), sinA = sin(A); float cosB = cos(B), sinB = sin(B); float cosTheta = cos(theta), sinTheta = sin(theta); float cosPhi = cos(phi), sinPhi = sin(phi); float circleX = cosTheta + 2; float circleY = sinTheta; float x = circleX * cosPhi - circleY * sinPhi * cosB; float y = circleX * sinPhi + circleY * cosPhi * cosB; float z = circleY * sinB + 5; float ooz = 1 / z; int xp = (int)(width / 2 + 30 * ooz * x); int yp = (int)(height / 2 - 15 * ooz * y); int idx = xp + width * yp; if (idx >= 0 && idx < 1760 && ooz > zBuffer[idx]) { zBuffer[idx] = ooz; buffer[idx] = ".,-~:;=!*#$@"[(int)(ooz * 8)]; } } } printf("\x1b[H"); // Move cursor to top-left for (int i = 0; i < 1760; i++) { putchar(i % width ? buffer[i] : '\n'); } A += 0.04; B += 0.08; } return 0; }
13th Feb 2025, 9:42 AM
prem Gaming
prem Gaming - avatar