Shubh Joshi
Hello everyone
I m first year engineering student...
Where can I get challenges for practice of C programming?
Golden Singh
for(int i=0;i<j;i++,j--)
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
//when i=3,j=1 then 3<1
why are loop not stoping
Nana
Anonymous
Can someone share a Good Learning Path to Learning C++ (With Sample Projects that can get you hands on too)
Nana
Roman
Stefano
Guys I'm using ncurses for a project, I have a function that through forks generates a process that controls a spaceship, since I have to generate n spaceships (controlled by n processes) I tried to loop the function but the spaceships are generated overlapping. Could you explain to me how I can solve this problem? the code is here: https://pastebin.com/59zYdsxh
Shubh Joshi
Optimus
Kenny Jai
Hi everyone
Kenny Jai
Given an integer num, return the number of steps to reduce it to zero.
In one step, if the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it.
Example 1:
Input: num = 14
Output: 6
Explanation:
Step 1) 14 is even; divide by 2 and obtain 7.
Step 2) 7 is odd; subtract 1 and obtain 6.
Step 3) 6 is even; divide by 2 and obtain 3.
Step 4) 3 is odd; subtract 1 and obtain 2.
Step 5) 2 is even; divide by 2 and obtain 1.
Step 6) 1 is odd; subtract 1 and obtain 0.
Kenny Jai
#include<stdio.h>
int main(){
int num;
int steps=0;
printf("Please enter the number:");
scanf("%d",&num);
while(num!=0){
num=(num%2==0)?num/2:num-1;
steps ++;}
return steps;
}
Kenny Jai
i don’t know why no output
Kenny Jai
Can anyone help?Thanks.
Talula
Talula
You should return 0 as there is no error in the code.
Kenny Jai
Oic😮
Kenny Jai
Thank you
\Device\NUL
Kenny Jai
Kenny Jai
Kenny Jai
Kenny Jai
How to modify my code🥲I just started to learn programming 🥲
Kenny Jai
Roshan
Prince Fine
Guys
I have a global declared values
Int a = 2 , int b = 3 and int c = 3.2
And
I have a func called int sum (int a, int b) { return a+b;}
What if the user send
sum(a,c) ;
What can we say about it
Ik it compile but what's the error
Anonymous
Please suggest me some topics for last year major project
coal
coal
an integer is a number without a fractional component (i.e. 3.2 is not an integer)
coal
when you want to declare a number with a fractional component you use a floating point number (float)
float c = 3.2;
otherwise it just gets truncated to an integer
int c = 3.2;
// c is now equal to 3
Prince Fine
Mike
Exercises
Write a program that, having acquired a sequence of integer values terminated by 0, evaluates the sum of the negative values and the sum of the positive values entered, and indicates which of the two is greater in absolute value.
Write a program that displays a row of dashes. The row must be of a length equal to a value entered by the user, between a minimum of 12 and a maximum of 37.
coal
coal
have you attempted solving it yourself first
Prince Fine
coal
nope
Mike
I do not know where to start
Anonymous
Hello there
Anonymous
Download mobile c on app store
coal
coal
using [] is invalid syntax
Anonymous
Hello there
coal
Anonymous
Any guidance on recursion
Mike
you know a site where he gives me the program done
Prince Fine
Anonymous
what
Some one requested an app for coding programs using c
coal
coal
if you want to return an array you specify that you want to return a pointer
Kenny Jai
Anonymous
Prince Fine
coal
Mike
do you know a site that gives the program already done?
coal
the second one would be "float*" instead of "float[]"
Prince Fine
coal
you're welcome
Anonymous
Anyone who knows batch language
coal
Anonymous
Am looking forward to understanding it both with assembly language for robotics
coal
coal
for example, you can use C/C++ with Arduino
coal
coal
"float* fun(int* arrayofint) {}"
Prince Fine
coal
you're welcome
coal
depends in your needs
coal
i find C to have a footprint low enough to be used in embedded programming
coal
plus, there's way more support in C than in assembly
\Device\NUL
Different arch different register, and different kernel has different syscall
coal
if you're using some form of assembly then you're either really serious about performance or really restricted
Anonymous