Pages

Thursday, January 23, 2025

1. Write a c program to display your Name, address and city in different lines.in C Language

#include<stdio.h>

int main() {

char Name[100], Address[100], City[100];

// Input Name, Address and City...

printf("Enter your Name: ");

fgets(Name, sizeof(Name), stdin);


printf("Enter your Address: ");

fgets(Address, sizeof(Address), stdin);


printf("Enter your City: ");

fgets(City, sizeof(City), stdin);


printf("---Displaying all the information below---");

printf("\nName: %s", Name);

printf("Address: %s", Address);

printf("City: %s", City);


return 0;

}


CODE:- Tested- Works.

No comments:

Post a Comment

remove duplicates from sorted array - two pointer approach (leetcode)

  class Solution {     public int removeDuplicates ( int [] nums ) {         // base case: return if array have no el.         if ( nums...