Details
Joined devRant on 6/6/2022
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
It's program of sort and merge two arrays.(in C)
When i enter 1 to 10 randomly that doesn't give me output like 1,2,3..10.
WHY?
CODE:
#include <stdio.h>
void main()
{
int i, j, n;
int arr1[5];
int arr2[5];
int ans[10];
for (i = 0; i < 5; i++)
scanf("%d", &arr1[i]);
for (i = 5; i < 10; i++)
scanf("%d", &arr2[i]);
for (i = 0; i < 10; i++)
{
if (i < 5)
ans[i] = arr1[i];
else
ans[i] = arr2[i];
printf("%d ", ans[i]);
}
printf("\n");
for (i = 0; i < 10; i++)
{
for (j = 0; j < 10; j++)
{
if (ans[j] > ans[j + 1])
{
n = ans[j + 1];
ans[j + 1] = ans[j];
ans[j] = n;
}
}
}
for (i = 0; i < 10; i++)
printf("%d ", ans[i]);
}4 -
Why this code is not give any output?
When i run,it gives me ERROR like SEGMENTATION FAULT CORE.
(C language)
#include <stdio.h>
void fun()
{
int arr[5] = {1, 2, 3, 4, 5};
int i, j;
static int n = -1, b = 0,k = 1;
int mari[5];
int max = arr[0];
if (k > 5)
return ;
for (i = 0; i < 5; i++)
{
if (arr[i] >= max)
{
for (; b <= 0; b--)
{
if (mari[b] == i)
{
continue;
}
max = arr[i];
n = i;
}
}
}
mari[b] = n;
b++;
k++;
printf("sdg %d", max);
fun();
}
void main()
{
printf("%d", fun());
}12 -
if possible please learn me on partition of number N ,Using C LANGUAGE.
For EX N= 6 thus,
Output is
6
51
42
411
33
321
3111
222
2211
21111
11111113 -
My question is"which value of 'a' and 'b' will give me output '1' not '0'?
C language's code is below here
#include<stdio.h>
int main()
{ float a=1.2,b=10.7;
printf("output is = %f",a&&b);
Return 0; }16