Wednesday 9 March 2016

ROBOT


Think that you are a scientist and you have invented a Humanoid Robo.You want to introduce your Robo in a public meeting.You need to feed the information that the Robo has to speak in the public meeting.So feed the basic information into the Robo using C program.

NOTE: The basic information includes the name of the Robo, creator, purpose of creation, Memory space of the Robo and its speed.

Input and Output Format:


Input consists of name (char array), creator (char array), purpose (char array), memory space (int), speed (float) and the output format is to display all the details in correct order. Refer sample input and output for further details. 

[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and output:
 Enter the Name :
 Chitti
 Enter the Creator Name :
 Dr.Vasegran
 Enter the Purpose :
 military service
 Memory Space :
 22
 Speed :
 1.1
 My Details :
 I am the Robot named Chitti.
 I was created by Dr.Vasegran.
 I am created for the purpose of military service.
 My memory space is around 22Gb and my speed is 1.1Tb.

Code:
  #include<stdio.h>
#include<string.h>
int main(){
  char name[100], creator[150], purpose[150];
  int mspace;
  float speed;
  printf("Enter the Name :\n");
  scanf("%s",name);
  printf("Enter the Creator Name :\n");
  scanf("%s",creator);
  printf("Enter the Purpose :\n");
  scanf("%s",purpose);
  printf("Memory Space :\n");
  scanf("%d",&mspace);
  printf("Speed :\n");
  scanf("%f",&speed);
  printf("My Details :\n");
  printf("I am the Robot named %s.",name);
  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 %.1fTb.",mspace,speed);
  return 0;
}

1 comment:

  1. it is only taking uptoenter memory space after that program is taking random numbers and printing

    ReplyDelete