Answers for "c++ to python code converter"

0

c++ to python code converter

#include<bits/stdc++.h>
#include <iostream>

using namespace std;


struct n{
    int d;
    struct n*next;
    };

void push(struct n**headref, int new_d)
{
    struct n* new_node=new n;
    new_node->d=new_d;
    new_node->next=(*headref);
    (*headref)=new_node;
    }
    
    float avgofnodes(struct n*head)
    {
        if(!head){return -1;}
        int c=0;
        int s=0;
        float avg =0.0;
        struct n*now=head;
        while(now!=NULL)
        {
            c++;
            s+=now->d;
            now=now->next;
            }
        avg=(double)s/c;
        return avg;
        }

int main()
{
struct n*head=NULL;
push(&head , 7);
push(&head, 6);
push(&head, 8);
push(&head, 4);
push(&head, 1);
	cout<<"Average of nodes = "<<avgofnodes(head);
return 0;	
}
Posted by: Guest on May-20-2021
0

c++ to python code converter

#include <iostream>

using namespace std;

int main()

{ int n=4,num-n-1; for(int i=1;i<n;i++) {

for(int j=1;j<=i;j++) cout<<num; cout<<endl;

num++;

}

num-;

for(int i=n;i>=1;i-)

{ for(int j=1;j<=i;j++) cout<<num; num--; cout<<endl;

}

return 0;
Posted by: Guest on July-05-2021
0

c++ to python code converter

int main{
int i, n;
cin>>n;
for(i=0; i<n; i++)
    cin>>a[i];
Posted by: Guest on July-04-2021
0

c++ to python code converter

int main{
int i, n;
cin>>n;
for(i=0; i<n; i++)
    cin>>a[i];
Posted by: Guest on July-04-2021

Code answers related to "c++ to python code converter"

Python Answers by Framework

Browse Popular Code Answers by Language