chevron_left

Recent posts tagged for-loop

0 0 2 min.
**Problem :** ========= I am very new to the programming world. According to my senior a for loop will always get executed at least once even if a required condition is not met. **Please find below example for your reference:** for (int i=6; i...
posted Nov 6 Alecxe01 807 points
0 0 1 min.
**Problem:** ======== Hello good soul, I am a newbie in python programming. I am having a problem printing both the name on the list and the email. Let me put it this way, I want to write a for loop to print each contact in contact_emails. Any solu...
posted Oct 26 Naymul01 996 points
0 0 2 min.
**Problem:** ======== I am struggling with a problem for a few hours back. I know how to sort an array by using methods. I was looking for another way (perhaps a loop) to do it more efficiently. Let me put my question this way, how to sort an array ...
posted Oct 26 Naymul01 996 points
0 0 1 min.
**Problem:** ======== Hello guys, I am trying to understand deeply how two variables work inside a for-loop or iterate simultaneously? Where to use it and what is the purpose of it in a program? Solution: --------- Generally, two different vari...
posted Oct 19 Naymul01 996 points
0 0 1 min.
**Problem:** ======== Hello guys, I’ve got a python list full of data. I want to print them reversely. The only condition that has to follow is to use a for-loop in the program. I know there could be several ways to do that but I want for-loop to d...
posted Oct 19 Naymul01 996 points
0 0 1 min.
**Problem:** ======== Hello Kodlogs, I am here with a problem. This could be a simple problem for you, guys, but it’s driving me crazy. I am in a situation that needs to print multiple values in a single line. Let me describe it in my words. Say, ha...
posted Oct 19 Naymul01 996 points
0 0 1 min.
**Problem:** ======== Hello kodlogs, How can we use for loop in python to iterate over the sequence of elements I have confusion over the range() function and the datatype like list, tuple, and string. Like how can we access the elements in the list...
posted Oct 19 Naymul01 996 points
0 0 1 min.
**Problem:** ======== Hello kodlogs, I am learning the python basic concept but while working on the string I having a doubt like how can I able to append to the string in the loops, I am having the list. list = ["alpha","beta","gamma","delta"]...
posted Oct 19 Naymul01 996 points
19 0 2 min.
**A counter used in a For Loop cannot be initialized within the for loop statement. true or false?** ======================================================================== Hi, In this post we will get the answer of the question - "A counter used i...
posted Sep 7 sakshi 955 points
16 1 3 min.
In this article we will discuss all different types of loops and their usage in JavaScript. This is hopefully going to be very informative for those looking to use loops in JS but wondering which should they use or just want to learn about loops. If ...
posted Aug 31 ahsanhanif99 202 points
19 0 2 min.
Normally, you can iterate through all elements in an array, map, vector, … using the ordinary for-loop:#include <iostream> using namespace std; int main() { int arr[] = {1, 2, 3, 4, 5}; for(int i = 0; i < 5; i++) { cout &...
posted Aug 23 hhh98hd 226 points
4 0 3 min.
For loop provides a concise way of writing the loop structure. Unlike a while loop, a for statement consumes the initialization, condition and increment/decrement in one line thereby providing a shorter, easy to debug structure of looping.Syntax:for ...
posted Aug 22 Yogesh Sharma 337 points
3 1 2 min.
string is one of the basic data types in C++ and among the most widely used. Therefore, it is a good thing to learn new knowledge about string in C++. In this article, I am going to show how to get a char from a string in C++...
posted Aug 16 hhh98hd 226 points
14 0 2 min.
In this article, I would like to share about how to convert a string to an int array. So let’s begin !In reality, computers do not have any conceptions of alphabetic letters and they can only understand numbers.  Thus, there is a...
posted Aug 10 hhh98hd 226 points
8 0 2 min.
C+11 intrpduced vector, which can be seen as a replacement for primitive arrays. In this article, I am going to represent to you the way to add elements to a vector. So let’s begin !To declare a vector, you just need to follow the syntax b...
posted Aug 10 hhh98hd 226 points
7 0 2 min.
As you know, a number is called prime if it is only divisible by 1 and by itself. For example, they are 2, 3, 5, 7, 11, 13, 17, ... In this article, I will present to you the way to check if a number is prime or not. So let’s begin !G...
posted Aug 6 hhh98hd 226 points
5 0 2 min.
In programming languages, conversion from a number to a string and vice versa is a popular task. In this article, I will guide you how to convert an int variable intro a string variable in C++. So let’s begin !Method 1: Usin...
posted Aug 6 hhh98hd 226 points
5 0 2 min.
In C++ char arrays are widely used along with other data types like int, double, float, string, .... For most cases, the first thing to do when working with char arrays is to get their lengths. To help you when dealing with c...
posted Aug 3 hhh98hd 226 points
7 0 2 min.
In C language, char arrays are widely used in many applications and algorithms. For most cases, the first thing to do when working with char arrays is to get their lengths. To help you when dealing with char arrays, in t...
posted Aug 3 hhh98hd 226 points
8 0 2 min.
Programming exercises for IT students often involve count number of elements that satisfy some criterias. One of them is the problem that requires to count the number of vowels in a string. In this article, I will show you how to solve this proble. L...
posted Aug 2 hhh98hd 226 points