C Programming Code for a Developed Program

Asked By 120 points N/A Posted on -
qa-featured

Hi,

Please help me write a program. I am new to programming and I need to make a program in C language. The question of my assignment is to develop a program that will show the output as follows:

*****

****

***

**

*

SHARE
Best Answer by MarkJason
Answered By 0 points N/A #88441

C Programming Code for a Developed Program

qa-featured

I don’t have a C compiler at this time. I am giving you the ideal solution for your question; please try this on a compiler and run before submission:

 
Int i,j;
 
For(i=1;i<=5;i++)
 
{
 
for(j=I; j<=5; j++)
 
{ cout<<”*”;}
 
endl
 
}
Answered By 120 points N/A #88442

C Programming Code for a Developed Program

qa-featured

There are many errors in this code. As I have mentioned above, I am new to programming and this is my first assignment. Can you please tell me what libraries I need to add in start?

Answered By 0 points N/A #88443

C Programming Code for a Developed Program

qa-featured

You need to add two library files:

  • #include<iostream.h>: we use this library for input and output
  • #include<conio.h>: we use this library for Getch(); at the end of program.
Answered By 270 points N/A #88444

C Programming Code for a Developed Program

qa-featured

I'm Waiting….

Answered By 120 points N/A #88445

C Programming Code for a Developed Program

qa-featured

Why is “endl” giving an error here? If I delete this line, the program is showing a screen full of * on it; why? Also, tell me the use of Getch() in this program.

Best Answer
Best Answer
Answered By 0 points N/A #88446

C Programming Code for a Developed Program

qa-featured

The actual running program for this problem is as follows; I hope it will help you a lot. Before going into details, I will answer your questions first.

“Endl” is giving an error because it is an idea solution dear. You need to work on your own; try to read your course also.
 
Getch(): We can use this in all our C programs because it is a command that is used to show the output screen until you press any character. When you press any character at the end the screen will disappear. Until then, you can view the output on your screen.
 
Pause() command is also used for the same reason.
 
The Code is:
 
#include<iostream.h>
 
#include<conio.h>
 
 Void Main()
 
{
 
int I,j;
 
Clrscr();
 
For(i=1;i<=5;i++)
 
{
 
for(j=I; j<=5; j++)
 
{ cout<<”*”;}
 
cout<<endl;
 
}
 
getch();
 
}
Answered By 0 points N/A #88447

C Programming Code for a Developed Program

qa-featured

MarkJason,

Brilliant and complete working. I appreciate your work and interest. Thanks a lot.

 

Answered By 120 points N/A #88449

C Programming Code for a Developed Program

qa-featured

Dear MarkJason,

I am extremely thankful to you for your marvelous help and working in programming languages. I will need your guidelines in future also. Please be there for me. God Bless You.

Stay Happy and Healthy.

Bye.

Answered By 0 points N/A #88450

C Programming Code for a Developed Program

qa-featured

Hey,

The above code of Mark Jackon doesn't even compile. I changed the return type of main to int, because that's the default return type for C++ codes in ideone, but even after that no progress. Check this out – 

https://ideone.com/Nxc0RM

In the program, he declared an integer variable I and he's using the int variable I in his programs. This doesn't work this way. It will give you an error. 

prog.cpp:7: error: ‘i’ was not declared in this scope

One cannot write –

For(i=1;i<=5;i++)

for loop is declared as –  

for(i = 1; i <= 5;i++)

You cannot use a capital F to write a for loop. It will give a compilation error.

Regards,

Sanders Danny 

Related Questions