Friday, March 29, 2024
03:50 PM (GMT +5)

Go Back   CSS Forums > CSS Optional subjects > Group I > Computer Science

Reply Share Thread: Submit Thread to Facebook Facebook     Submit Thread to Twitter Twitter     Submit Thread to Google+ Google+    
 
LinkBack Thread Tools Search this Thread
  #1  
Old Sunday, February 20, 2022
Junior Member
 
Join Date: Feb 2022
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
davidweb is on a distinguished road
Default Answers required for computer science paper

Complete the code such that it prompts the user for +ve number n. Then displays the output.(whatever the value of n is)(HINT: instead of triangles of stars its triangles of increasing numbers)

1 2 3 4 . . . n
1 2 3 4 ..n-1
. . .
. . .
1 2
1

for n=4 it will print
1 2 3 4
1 2 3
1 2
1
void main()
{
int n; cin>>n;

// your loops will go here

}



In following code replace the character at posth location in the string st with the ,character ch. For example in string helloworld replacing 2nd character with i would result in hilloworld

void main( )

{char st[15]; int pos; char ch;
int size=0;
cin>>st;
cin>>pos>>ch;
while(st[size]!='\0')
{
size++; // calculating length of current string
}
// write your code here
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
latest MCQs on C.A and General knowledge sono punam Current Affairs 2 Friday, November 22, 2019 11:16 PM
NAB Karachi 2016 Jobs sajjadhussainjarwar National Accountability Bureau (NAB) 72 Sunday, January 01, 2017 11:14 PM
CULTURAL EXCHANGE SCHOLARSHIPS PROGRAMME FOR YEAR 2016 by IPC fahadk Scholarships 358 Friday, December 02, 2016 12:23 AM


CSS Forum on Facebook Follow CSS Forum on Twitter

Disclaimer: All messages made available as part of this discussion group (including any bulletin boards and chat rooms) and any opinions, advice, statements or other information contained in any messages posted or transmitted by any third party are the responsibility of the author of that message and not of CSSForum.com.pk (unless CSSForum.com.pk is specifically identified as the author of the message). The fact that a particular message is posted on or transmitted using this web site does not mean that CSSForum has endorsed that message in any way or verified the accuracy, completeness or usefulness of any message. We encourage visitors to the forum to report any objectionable message in site feedback. This forum is not monitored 24/7.

Sponsors: ArgusVision   vBulletin, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.