Anda di halaman 1dari 2

Hello World 1

#include<stdio.h> //Standard Input/Output Header File


int main() // main function
{
printf("Hello World!"); //Standard Output Function
return 0;
}
Hello
#include<stdio.h> //Standard Input/Output Header
int main() //main function
{
printf("Hello Aliens ! Welcome to our planet Earth."); //printf-standard outp
ut function
return 0;
}
ROBOT
#include<stdio.h>

//Standard Input/Output Header File

int main()
//main function
{
//Declaring Necessary Variables
char robo[30];
//Name of ROBOT
char creator[30];
//Name of the Creator
char purpose[30];
//Purpose of the ROBOT
int mem=0;
//Memory of the ROBOT
float spd=0.0;
//Speed of the ROBOT
//Gathering Input
printf("Enter the Name :");
scanf("%s",robo);
printf("\nEnter the Creator Name :");
scanf("%s",creator);
printf("\nEnter the Purpose :");
scanf("%s",purpose);
printf("\nMemory Space :");
scanf("%d",&mem);
printf("\nSpeed :");
scanf("%f",&spd);
//Giving out the output
printf("\nMy Details :");
printf("\nI am the Robot named %s.",robo);
printf("\nI was created by %s.",creator);
printf("\nI am created for the purpose of %s.",purpose);
printf("\nMy memory space is around %dGb and my speed is %gTb.",mem,spd);
return 0;
}
Newspaper Report
#include<stdio.h>

//Standard Input/Output Header

int main()
ion
{
//Declaring Necessary Variables with default Value

//the main funct

int dead,inj,safe;
dead=0;
inj=0;
safe=0;
//Prompt user for details using printf statement
printf("\nEnter the number of people dead:");
//Get details from user using scanf Statement
scanf("%d",&dead);
printf("\nEnter the number of people injured:");
scanf("%d",&inj);
printf("\nEnter the number of people safe:");
scanf("%d",&safe);
//Display the Output
printf("\nTSUNAMI REPORT OF JAPAN");
printf("\nThe number of people");
printf("\n1)Dead:%d",dead);
printf("\n2)Injured:%d",inj);
printf("\n3)Safe:%d",safe);
printf("\nPlease help the people who are suffering!!!");
return 0;
}

Anda mungkin juga menyukai