Array Problem

  Рет қаралды 62,239

Problem solving through Programming In C - IITKGP

Problem solving through Programming In C - IITKGP

Күн бұрын

Пікірлер: 31
@adarshyadav340
@adarshyadav340 5 жыл бұрын
Whenever the elements of both the arrays are equal just increment the value of flag from 0 and at last compare it with array size if both are equal then array is equal
@sannin9875
@sannin9875 3 жыл бұрын
woow super ,excellent
@mahmoudelkhadragy8154
@mahmoudelkhadragy8154 5 жыл бұрын
as i think break ; statement is not a good solution as it breaks the code suddenly and go out from the loop or if condition we can do that as an another solution int a[4] = { 2,5,7,4 }, b[4] = { 2,5,7,4 },i , flag1 = 0, flag2 = 0; for (i = 0; i < 4; i++) { if(a[i] == b[i]) { flag1 = 1; } else { flag2 = 1; } } if (flag1 == 1 && flag2 == 0) { printf("array a equal array b "); } else { printf("array a not equal array b "); }
@hassansyed5661
@hassansyed5661 3 жыл бұрын
Break won't break the code. Think for a second if we are comparing a large array elements then it will waste a lot of CPU cycles which could be easily saved with the help of break statement.
@sarcaastech
@sarcaastech 6 жыл бұрын
sir we can use break statement with and print that the array are not equal .... so whenever the comditions fail we will come out of loop flag=1 for(i=0;i
@3325631273
@3325631273 4 жыл бұрын
if they are equal then also it will show arrays are not equal
@pragyagupta7736
@pragyagupta7736 4 жыл бұрын
Use the printf statement properly coz in this code at the end it anyway prints arrays are not equal. Rest is fine...👍
@MEFRAJANS
@MEFRAJANS 4 жыл бұрын
No bro. because once loop kum once statement print agum.
@hussainkhan-fg1lv
@hussainkhan-fg1lv 4 жыл бұрын
@@pragyagupta7736 yes its out side the else block
@pragyagupta7736
@pragyagupta7736 4 жыл бұрын
@@hussainkhan-fg1lv yep🙂
@n.hemanthkumar1615
@n.hemanthkumar1615 4 жыл бұрын
we can use int main() { int flag=1; for(i=0;i
@7cyuthika751
@7cyuthika751 2 жыл бұрын
CRT
@deependrasingh2636
@deependrasingh2636 3 жыл бұрын
Outstanding fantastic mind-blowing sir
@sandeeppateriya1765
@sandeeppateriya1765 5 жыл бұрын
Once we get flag= 0, we can use 'exit' to come out and hence our problem is solved..
@vinodkumarpvinod6679
@vinodkumarpvinod6679 3 жыл бұрын
Respected sir thanks for teaching us We are very proud to have such a professor India proud to be an indian sir
@bhargavdihora1245
@bhargavdihora1245 4 жыл бұрын
We can define flag[4], in this case and put another for loop after this entire programme as follows for(i=0;i
@MEFRAJANS
@MEFRAJANS 4 жыл бұрын
I think not possible
@hussainkhan-fg1lv
@hussainkhan-fg1lv 4 жыл бұрын
This loop will be executed after the previous one so then loop will not change anything you will still have to deal with the problem My suggestion at 15:26 : just put a "exit" below "flag =0" And also add #include as "exit statement is a part of this library.
@rishabhgupta5460
@rishabhgupta5460 6 жыл бұрын
Sir we can put a break statement with else condition.
@ritikpanwar8956
@ritikpanwar8956 5 жыл бұрын
Yes you can
@hussainkhan-fg1lv
@hussainkhan-fg1lv 4 жыл бұрын
Yes
@AshishKumar-zc5bc
@AshishKumar-zc5bc 4 жыл бұрын
clear the concept of array
@srinidolic
@srinidolic 5 жыл бұрын
Sir could you please mention the function of "flag" variable in the problem stated and also please give applications of it too.
@jyotimanral2989
@jyotimanral2989 5 жыл бұрын
srinidolic flag is just a variable used in this problem to check whether the elements os the 2 arrays are comparable or not.It has no such application
@kangtheconqueror3639
@kangtheconqueror3639 2 жыл бұрын
program to compare two array #include int main() { int a[5],b[5],i,flag=1; printf("enter the first array "); for (i=0;i
@ChandanAkbarpuria
@ChandanAkbarpuria 3 жыл бұрын
Instead of flag =1(assignment) We can use 'continue' keyword
@sritamkunu9155
@sritamkunu9155 4 жыл бұрын
Just add a else if block if ..if blok will be false then else if blok will execute and from elseif blok we have to write logic to flag to again zero
@likithgullapudi2275
@likithgullapudi2275 3 жыл бұрын
14:21 use another array for flag simple
@saikatchatterjee4869
@saikatchatterjee4869 6 жыл бұрын
can anybody send the slides of every week
@MdSahidReja19
@MdSahidReja19 6 ай бұрын
#include int main() { int a[]={2,5,7,4},b[]={2,5,6,4},i; int flag = 1; for( i=0; i
@pranavchaitu
@pranavchaitu Жыл бұрын
#include int main() { int arr1[] = {1,3,2}; int arr2[] = {1,3,2}; int flag = 0; for(int i=0;i
Program using Arrays
30:12
Problem solving through Programming In C - IITKGP
Рет қаралды 66 М.
Introduction to Arrays
27:33
Problem solving through Programming In C - IITKGP
Рет қаралды 106 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 15 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,5 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 37 МЛН
When Rosé has a fake Fun Bot music box 😁
00:23
BigSchool
Рет қаралды 5 МЛН
9.1: What is an Array? - Processing Tutorial
7:09
The Coding Train
Рет қаралды 376 М.
Arrays (Contd.)
28:47
Problem solving through Programming In C - IITKGP
Рет қаралды 72 М.
Assignment Statement and Operators in C
30:24
Problem solving through Programming In C - IITKGP
Рет қаралды 123 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Brian Will
Рет қаралды 2,1 МЛН
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
Arrays (Contd1.)
31:12
Problem solving through Programming In C - IITKGP
Рет қаралды 64 М.
How to STUDY so FAST it feels like CHEATING
8:03
The Angry Explainer
Рет қаралды 2,2 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 15 МЛН