self learn c language
Display asterisk from one to nine. Add one thing
#include <stdio.h> int main(void){ int n = 0; for(n;n<10;n++){ int i = 0; for(i;i<=n;i++){ printf("*"); } printf("\n"); } return 0; }
Addition from one to one hundred.
#include <stdio.h> int main(void){ int wa = 0; int i = 1; while(i<=100){ wa = wa+i; i++; } printf("%d\n",wa); return 0; }
If input value is not 0,Ask repeat "please input something" and to add input value.
#include <stdio.h> int main(void){ int wa = 0; int data; printf("いれて\n"); scanf("%d",&data); while(data!=0){ wa=wa+data; printf("%d",wa); printf("いれて\n"); scanf("%d",&data); } return 0; }