C - Print square, cube and square root of all numbers C - Print all leap years from 1 to N C - Print all upper case and lower case alphabets C - Read age of 15 person and count total Baby, School, and Adult age C String Programs C program to print indexes of a particular charac...
/*C program to print string character by character*/#include<stdio.h>intmain(){charname[]="Alvin Alexander";inti;printf("name is:");for(i=0;name[i]!='\0';i++)printf("%c",name[i]);printf("\n");return0;} Output
C Program #include <stdio.h> int main() { int i, j; char input, alphabet = 'A'; printf("Enter an uppercase character you want to print in the last row: "); scanf("%c", &input); for (i = 1; i <= (input - 'A' + 1); ++i) { for (j = 1; j <= i; ++j) {...
Write a C program to print numbers from 1 to 10 and 10 to 1 using a do-while loop. Sample Solution:C Code:#include <stdio.h> int main() { int i = 1; // Initialize the loop control variable to 1 // Print numbers from 1 to 10 printf("Print numbers from 1 to 10:\n"); do...
This is a C Program to input a string & store their Ascii Values in an Array & print the Array Problem Description This program will take an input of string & store their ASCII values and print them. Problem Solution 1. Create an array of characters and take its size from users as an...
See the, C program to print hollow right triangle star pattern:#include <stdio.h> int main() { int x = 0,y = 0; unsigned int rows = 0; printf("Enter the number of rows = "); scanf("%u",&rows); for(x=1; x<=rows; ++x) { for(y=1; y <= x; ++y) { if((y==1)...
printf("\n Please enter Valid Number between 1 to 7"); } return0; } Output: Enter week number (1-7): 5 Friday C program to print day name of week using an array: The below program used a const string array to store the days on the corresponding array index. Now ask the user ...
1. Current DateTime PrintWrite a program in C to print the current date and time.Sample Solution:C Code:#include #include <stdio.h> #include <stdlib.h> int main(void) { time_t cur_time; // Variable to hold the current time char* cur_t_string; // String to store the formatted ...
/* print a person’s info */ void person_print(struct person *p) { printf(“Name : %s\n”, p->name); printf (“Gender : %s\n”, p->gender == ‘M’ ? “Male” : “Female”); printf (“Age : %d\n”, p->age); } You’ll also like: Write Program to Read in an INT...
// C program to print the name of // source code file #include <stdio.h> int main() { printf("Name of source file: %s\n", __FILE__); return 0; } OutputName of source file: main.c ExplanationAs we know that, a project may contain multiple source code files. Then if we ...