Write a program that find and print how many odd numbers in
a binary tree
struct node
{
int data;
struct node *l;
struct node *r;
};
typedef struct node *n;
int oddnos(n root)
{
static int count;
n cur = root;
if(cur!=NULL)
{
if(cur->data%2==1)
count++;
oddnos(root->l);
oddnos(root->r);
}
return count;
}
| Is This Answer Correct ? | 8 Yes | 5 No |
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
How we print the table of 3 using for loop in c programing?
Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector
how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }
what is variable length argument list?
#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }
There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }
main() { printf("%x",-1<<4); }
main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }
Write a program to print a square of size 5 by using the character S.
main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }