Skip to content

Instantly share code, notes, and snippets.

#Task 1:
#Write a program that asks the user for 3 numbers and outputs the average of the numbers.
'''
sum =0
for i in range(1,4):
num = int(input('Enter number {}: '.format(i)))
sum += num
print('Average is: {}'.format(sum/3))
x = 5
y = 10
temp = x
x = y
y = temp
print(x)
print(y)
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <string>
#include<iostream>
using namespace std;
class Cat
{
string name;
string breed;
int age;
public:
void setName(string nameIn);
/*Goal: practice creating and using classes.
**Create a class called Cat.
**Create the following members:
**private members: name, breed, age
**public members: setName, setBreed,setAge
**getName, getBreed, getAge, printInfo*/
#include<iostream>
using namespace std;
class Dog
{
string name;
int licenseNumber;
public:
void setName(string nameIn);
//Give this class
/*The header file for main.cpp*/
#include<iostream>
using namespace std;
class Dog
{
string name;
/*Goal: Practice using a class*/
#include<iostream>
using namespace std;
class Student
{
string name;
int id;
package com.reviapps.traveldistance.business;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
///// variable naming /////
//bad
double m1=13;
double m2=14;
double sum = m1+m2;
//kinda better
double mark1 =13;
double mark2 =14;
double sum_marks = mark1+mark2;