Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions 2nd_sem/Pull_Requests/Riya_Singh_DS_38/Problem1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<stdio.h>

int main()
{
int n = 3 ;

printf("Enter number : ");
scanf("%d",&n);

printf("%d ",n);

while(n != 1){
if(n % 2 == 0){
n = n/2;
}
else{
n=3*n+1;
}
printf("%d ",n);
}
return 0;
}
22 changes: 22 additions & 0 deletions 2nd_sem/Pull_Requests/Riya_Singh_DS_38/problem2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<stdio.h>

int main()
{
int n = 3 ;

printf("Enter number : ");
scanf("%d",&n);

printf("%d ",n);

while(n != 1){
if(n % 2 == 0){
n = n/2;
}
else{
n=3*n+1;
}
printf("%d ",n);
}
return 0;
}
35 changes: 35 additions & 0 deletions 2nd_sem/Pull_Requests/Riya_Singh_DS_38/problem3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <stdio.h>

int main()
{
int n, t1, t2, x, y, movie = 1, endt;


printf("Enter the number of movies : ");
scanf("%d", &n);

printf("Enter the starting time of the 1st movie : ");
scanf("%d", &t1);

printf("Enter the ending time of the 1st movie : ");
scanf("%d", &t2);
endt=t2;

for (int i = 1; i < n; i++) {

printf("Enter starting time of the next movie : ");
scanf("%d",&x);

printf("Enter the endig time of the next movie : ");
scanf("%d",&y);

if (endt<=x) {
movie++;
endt = y;
}
}

printf("Maximum number of movies that can be watched are : %d\n", movie);

return 0;
}