C++

Status
Not open for further replies.

mavihs

Techie By Heart
can u guys give me a site where i can reffere about c++ & get some solution.
& i got this prob with some question i hav. if u guys can solve it or give a hint or anything.

here it is:-
1) WAP to display th following format on the screen.(using loop)
Code:
       1
       1   2
       1   2   3
       1   2   3   4
2) WAP to display th following format on the screen.(using loop)
Code:
[CENTER][CENTER]1
1   1   1
1   1   1   1   1
1   1   1   1   1   1   1[/CENTER]
 [/CENTER]
3) WAP to print the sum of the following series

1-(x/2!)+(x2/3!)-(x3/4!)+. . . . . . . . . . . . . . +(-1)n(xn/(n+1)!)


plzzzzzzz give the ans or atleast a hint or somthing. I got an exam on monday. i hav 2 prepare for it. i can't understand these question how 2 do. plzzzzz help!
 

kg_87

Broken In
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j;
for(i=1;i<6;i++)
{
for(j=1;j<i;j++)
{
cout<<"\t"<<j;
}
cout<<"\n";
}
getch();
}

here is the hint ;) Now try making other two programs :)
 

Ron

||uLtiMaTE WinNER||
Hey.......... c++ is getting popular day by day................. in the forum..............
 

Gigacore

Dreamweaver
Post it here instead..... you will get more response

*www.thinkdigit.com/forum/showthread.php?t=67133
 
OP
mavihs

mavihs

Techie By Heart
it was suppose 2 be class work but no 1 completed it. it may come in the exam which is 2moro so i'm really scared if it comes. just tell me how 2 do the second 1. rest of them 1 can figure out but it'll take time. plzzzzzzzzzzzzz. til 2nigth can u give me the ans.
 

casanova

The Frozen Nova
Do it on your own. I will give you the logic for the second proggy.

Ask user how many lines. Answer five. So, it means last line should have 9 ones.

so u can use a for loop until i<lines
another for loop with in it j<(lines-i)/2
print a space here
when the loop exits, you can print the no

for (i=0;i<lines;i++)
{
for (j=0;j<(lines-i)/2;j++)
printf("\t");
printf("1");
}

Haven't checked it. But this should work with little or no modification. :D
 
OP
mavihs

mavihs

Techie By Heart
thanks. anyway my exam is over. now i'll be preparing for the practical which will be after a week or so. So i got more time 2 solve these questions & understand them. anyway thank 2 all. :)
 
Status
Not open for further replies.
Top Bottom