Print integer value using while loop
Before Executing this program, First, try to understand, Print integer value using while loop, we know why to use While loop() because while guarantees block will execute at least once. we try to understand this Program or Read here isalpha() function.
Program using while loop in C
#include <stdio.h> void copy_string(char*,char*); int main() { char source[100],target[100]; puts("enter source string:\n"); gets(source); copy_string(target,source); printf("target string is\"%s\"\n",target); return 0; } void copy_string(char *target,char *source){ while(*source) { *target=*source; source++; target++; } *target='\0'; }
Example of while loop Output
Enter source string: 2 3
target string is”2 3″