In this lab we look at molecular formulae written out as follows:
H

Comments
Nothing is URGENT here, as you would have known if you had bothered reading the Rules as requested.

Start by doing 1a which is very basic and quite simple. Then start adding the code for 1b. When you get stuck actually coding, we can help you overcome those problems. But you have to code something for us to help with.

yea but cld you provide some tips/pointers on how i even go abt startin it?from where do i start?

(sorry,im a beginner)

ok i got it..can someone help me check this code?

#include<stdio.h>

int main()
{
	char a[20];
	int count=0;
	int b=0;

	for(count=0;count<20;count++)
	{
		printf("\nPlease enter a character or '.' to stop:");
		scanf("%c", &a[count]);
		getchar();

		if (a[count]=='.')
		{
			break;
		}
	}
	while(count==20)
	{
		a[count]='.';
		break;
	}

	for(b=0;b<=count;b++)
	{
		printf("%c", a[b]);
	}


	return 0;
}

Edited 7 Years Ago by bliya123: n/a

This article has been dead for over six months. Start a new discussion instead.