Total Pageviews

Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Program to print "Hello World!!".

/*
 * First C program that says Hello (Hello.c)
 */
#include               // Needed to perform IO operations
 
int main() 
{                               // Program entry point
    printf("Hello, world!\n");  // Says Hello
    return 0;                   // Terminate main()
}                               // End of main()





output

 Hello, world!

draw a circle on a rectage python program

Python program to draw a circle on rectangle


import turtle                 # allows us to use the turtles library

wn = turtle.Screen()     # creates a graphics window
wn.setup(500,440)      # set window dimension

circle_rad=100              # set the radius
rectangle_width=250   # set the width
rectangle_height=160   # set the height

alex = turtle.Turtle()   # create a turtle named alex
alex.shape("turtle")    # alex looks like a turtle
alex.color('red')         # alex has a color
alex.circle(circle_rad)
alex.backward(rectangle_width/2)
alex.forward(rectangle_width)
alex.right(90)
alex.forward(rectangle_height)
alex.right(90)
alex.forward(rectangle_width)
alex.right(90)
alex.forward(rectangle_height)