WEEK:3 PROGRAMMING ASSIGNMENT 2 SOLUTION (Jan 2020-Apr2020) An Introduction to Programming through C++ NPTEL 2020

  

               An Introduction To Programming Through C++


IIT Bombay.
CLICK ON LINK FOR WEEK 4 QUIZ

CLICK HERE FOR WEEK 4 QUIZ



Week 3- Programming Assignment 2:

SEE THIS VIDEO IF ANY PROBLEM:

*The following program is supposed to read 10 numbers and print 1 if some 3 consecutive numbers are identical, and print 0 otherwise.

Sample Test Cases              Input                                     Output
Test Case 1               5 1 9 23 23 23 9 -5 6 7                     1
Test Case 2               1 2 3 4 5 6 6 7 8 9                            0
Test Case 3               0 0 55 55 666 666 777 777 7 7        0

WRITE/COPY THESE CODE DIRECTLY IN NPTEL TERMINAL AND COMPILE AND RUN THEN SUBMIT.

PROGRAM:


if (C == 3) FOUND = true;
    int x; cin >> x;
    if(x == L) C++;
    else{ L = x; C=1;}
  

WEEK :4 QUIZ 1 SOLUTION 
CLICK ON BELOW LINK.
FOLLOW OUR WEBSITE FROM THE BUTTON PROVIDED TO THE BOTTOM OF PAGE TO GET SOON ANSWERS OF PROGRAMS.

<<CLICK HERE FOR  PROGRAMMING ASSIGNMENTS 1  WEEK 3>>
<<CLICK HERE FOR QUIZ  WEEK 4>> COMMENT IF YOU HAVE ANY PROBLEM WITH THE SOLUTIONS.

Disclaimer: Here you can find all nptel assignment solutions related to CS stream.These may help you for your assignment.The answers are only for verification.You cannot copy these directly from the post(code of conduct of NPTEL).These is not 100%  correct solutions. 

2 comments:

  1. Program
    Programtest.cpp: In function int main(): test.cpp:40:5: error: c was not declared in this scope if (c == 1) FOUND = true; ^

    ReplyDelete
    Replies
    1. In program there is capital 'C' not small 'c'

      Delete

If you have any problems related to solutions or any concept please let me know.

Copyright (c) 2020 Custom Programs All Right Reserved

Pages