massage dosent want to be shown what is the problem

this is the program in c
please may any one know way is that the code has no broblems just the output
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#include <stdio.h>
void main ( )
{
int i,j,k, match, ncases;
char *message;
printf ("Enter number of triangle \n");
scanf (" %d", &ncases);
/* start loop */
while (ncases)
{
ncases--;
printf ("\nEnter sides of trinagle\n");
scanf("%d %d %d", &i, &j, &k);
if ((i>=j+k) || (j>=k+i) || (k>=i+j))
{
message="Not a triangle"; }
else
{
match=0;
if (i==j)
{
++match; }
if (j==k)
{
++match; }
if (k==i)
{
++match; }
if (match==0)
{
message="Scalene triangle"; }
else
{
if (match==1)
{
message="Isosceles triangle"; }
else
{
message="Equilateral triangle"; }
}
}
printf ("%d %d %d %S\n",i,j,k,message);
}
}

it should be %s and not %S.

** make it a habit of posting beautiful code so that people like to read the code. Without proper indentation, it becomes hard to point the problems.
it should be something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void main ( )
{

	int i,j,k, match, ncases;
	char *message;
	printf ("Enter number of triangle \n");
	scanf (" %d", &ncases);
	/* start loop */
	
	while (ncases)
	{
		ncases--;
		printf ("\nEnter sides of trinagle\n");
		scanf("%d %d %d", &i, &j, &k);
		if ((i>=j+k) || (j>=k+i) || (k>=i+j))
		{
			message="Not a triangle"; 
		}
		else
		{
			match=0;
			if (i==j)
			{
				++match; 
			}
			if (j==k)
			{
				++match; 
			}
Last edited on
Topic archived. No new replies allowed.