Search
 
SCRIPT & CODE EXAMPLE
 

C

convert c to C language

#include <iostream>
#include <queue>
using namespace std;
struct Node{
   int data;
   struct Node* left, *right;
};
// Function to count the full Nodes in a binary tree
int fullcount(struct Node* node){
   // Check if tree is empty
   if (!node){
      return 0;
   }  
   queue<Node *> myqueue;
   // traverse using level order traversing
   int result = 0;
   myqueue.push(node);
   while (!myqueue.empty()){
      struct Node *temp = myqueue.front();
      myqueue.pop();
      if (temp->left && temp->right){
         result++;
      }
      if (temp->left != NULL){
         myqueue.push(temp->left);
      }
      if (temp->right != NULL){
         myqueue.push(temp->right);
      }
   }
   return result;
}
struct Node* newNode(int data){
   struct Node* node = new Node;
   node->data = data;
   node->left = node->right = NULL;
   return (node);
}
int main(void){
   struct Node *root = newNode(10);
   root->left = newNode(20);
   root->right = newNode(30);
   root->left->left = newNode(40);
   root->left->right = newNode(50);
   root->left->left->right = newNode(60);
   root->left->right->right = newNode(70);
   cout <<"count is: "<<fullcount(root);
   return 0;
}
Comment

convert in c

#include<iostream>
#include<string>
using namespace std;

int main()
{
   int n,k,ans,t1;
   cin>>n>>k;
   ans=240-k;
   for(int i=1;i<=n;i++)
   {
       ans-=(i*5);
       if(ans<0)
       {
           t1=i-1;break;
       }
   }
   if(ans>=0)
   {cout<<n<<endl;}
   else {cout<<t1<<endl;}

return 0;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Comment

PREVIOUS NEXT
Code Example
C :: parcel-builder put image in sub folder 
C :: what happens if i acess a freed variable in c 
C :: modelform prefill with data 
C :: C++ How to use enums for flags? 
C :: Answer to storing information in array 
C :: C Operator associativity 
C :: leer string en c 
C :: check if a number is even and bigger than or equal to 16 using bitwise 
C :: can torch light bring change in chemical reaction 
C :: npm fs zip 
C :: ejemplo c holamundo 
C :: 1 f = c 
C :: sum of fibonacci series in c 
C :: programme c qui permet de determiner si M et N sont amis ou non 
C :: change data type inline in c 
C :: Chef in Vaccination Queue codechef solution in c++ 
C :: determination data type in c 
C :: esp rainmaker led 
C :: sadsa 
C :: os.listdir to array 
C :: fread condition 
C :: The closest in between 
C :: Dividing canvas in live2d 
C :: c arrays 
C :: mitch mcconnell 
Dart :: listview.separated flutter 
Dart :: flutter label align top 
Dart :: flutter beta switch 
Dart :: options = null firebaseoptions cannot be null when creating the default app. flutter 
Dart :: print variable types in flutter 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =