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 upgrade LOOP environment, I just mean, how can i make loop statement editable ? I just try some program using loop statement and checking it in multiple compilers. Every compiler showing different output, what's the wrong ? is it a compiler based problem, or loop based problem, tell me why ? and what will be the debugging process, for this kind of problem ?
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
what are the techniques for reducing the fragility of a memory bug?
loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.
A sample program using data structure? what is file handling?
what is syntax error?
printy(a=3,a=2)
void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....
Write a c-programe that input one number of four digits and find digits sum?
void main() { int i=7; printf("N= %*d",i,i); }
who was the present cheif governor of reserve bank of india
6 Answers State Bank Of India SBI,
I am using Qt 5.6 during compilation it stops and gives error about Qmake The process "C:QtQt5.6.35.6.3msvc2015_64inqmake.exe" crashed. Error while building/deploying project untitled1 (kit: Desktop Qt 5.6.3 MSVC2015 64bit) When executing step "qmake"