Accept the Name and Age of the Given Person and Print them in the Following Format Name:Age - Learn Engineering

All the news and updates relevant to Engineering. You can also Write a post here

Breaking

Thursday, July 9, 2020

Accept the Name and Age of the Given Person and Print them in the Following Format Name:Age

Learn C programming

Question

Accept the Name and Age of the Given Person and Print them in the Following Format Name: Age

Sample TestCase Expected Output

1. Mr X 21Mr X: 21

2. Mr Y 22Mr Y: 22

Answer

#include <stdio.h>
#include <string.h>
int main()
{
    char str[100];
    int age;
    scanf("%s %d",str,&age);
    printf("%s: %d",str,age);
    return 0;
}


Comment What problem Do you Need...

Follow Us For More...

1 comment: