Given an int variable n that has already been declared and
initialized to a positive value, and another int variable
j that has already been declared, use a do...while loop to
print a single line consisting of n asterisks. Thus if n
contains 5, five asterisks will be printed. Use no variables
other than n and j .
Answers were Sorted based on User's Feedback
Answer / venkadesan
n is not get the values
so,it'a no either printed
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / mahfooz
//1st method..
there is no use of j.as explained below
int j,n=psitive value;
do
{
cout<<"*";
n--;
}while(n!=0);
//2nd we can use j..
int j=0;
do
{
cout<<"*";
j++;
}while(j!=n);
Is This Answer Correct ? | 11 Yes | 14 No |
How to develop a program using C language to convert 8-bit binary values to decimals. TQ
which typw of errors ? & how to solve it ?
write a profram for selection sort whats the error in it?
what is run time error?
I can not get my C++ program to work right. It is supposed to tell if a word is a palindrome or not, but it only tells thet the word is not a palindrome. And I can't fix it.
what is meant for variable not found?
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
I'm having trouble with coming up with the correct code. Do I need to put a loop? Please let me know if I'm on the right track and what areas I need to correct. I still don't have a good grasp on this programming stuff. Thanks =) The assignment was to write a program using string functions that accepts a coded value of an item and displays its equivalent tag price. The base of the keys: 0 1 2 3 4 5 6 7 8 9 X C O M P U T E R S Sample I/O Dialogue: Enter coded value: TR.XX Tag Price : 68.00
How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis
what are the techniques for reducing the fragility of a memory bug?
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
How to reverse a linked list without using array & -1? Thank you.