【c語言】輸出一個圖形
/* 輸出 ********** very good! ********** */ #include <stdio.h> int main() { int i; for( i = 0; i < 10; i++) { printf("*"); } printf("\n"); printf("very good!\n"); for( i = 0; i < 10; i++) { printf("*"); } printf("\n"); return 0; } <img src="https://img-blog.csdn.net/20150423113851970?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
相關推薦
【c語言】輸出一個圖形
/* 輸出 ********** very good! ********** */ #include <stdio.h> int main() { int i; for( i = 0; i < 10; i++) { print
【C語言】輸入一個整數,輸出該數二進位制表示中1的個數(三種方法)
輸入一個整數,輸出該數二進位制表示中1的個數。如輸入32,輸出1.程式碼實現:方法1:與運算#define _CRT_SECURE_NO_WARNINGS 1 #include<iostream> using namespace std; int FindOne
【c語言】給一個不多於五位的正整數: 1.求出它是幾位數 2.分別輸出每一位數字 3.逆序輸出各位數字
#include<stdio.h> #include<math.h> //求出它是幾位數 int Count(int n) { int tmp = 0; while (n != 0) { tmp++; n /= 10;
【C語言】輸出好看的星星圖形
想要輸出下面的星星圖案 * *** ***** ******* ********* *********** ************* **********
【c語言】給一個不多於5位的正整數,要求: 1、求出它是幾位數 2、分別輸出每一位數字 3、按逆序輸出各位數字
// 給一個不多於5位的正整數,要求: // 1、求出它是幾位數 // 2、分別輸出每一位數字 // 3、按逆序輸出各位數字 #include <stdio.h> #include <math.h> int main() { int a,b,c
【C語言】輸入一個整數,求它的原碼,反碼,補碼值
補碼 while src info idt IV com scan -- 1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int m,n,a[10],i=0,y[
【C語言】統計一個字串中字母、數字、空格及其它字元的數量
統計一個字串中字母、數字、空格及其它字元的數量 解法1: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> void Count(con
【C語言】實現一個計算器(兩種方式)
1.使用switch…case…語句實現 #define _CRT_SECURE_NO_DEPRECATE 1 #include <stdio.h> #include <stdlib.h> int add(int x, int y) { &nb
【C語言】輸入一個整數N,求N以內的素數之和
【C語言】輸入一個整數N,求N以內的素數之和 /* ============================================================================ Name
【C語言】對一個n*n矩陣,通過行變換,使其每行元素的平均值按遞增順序排序
#include<stdio.h> int main() { int n,a[100][100],r,c,i,j; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<n;j++) scanf("%d",&am
【C語言】編寫一個折半查詢函式
#include <stdio.h> int zheban(int x,int arr[],int left,int right) { while(left<=right) {
【C語言】輸出“*”菱形圖案
問題:在螢幕上輸出一個菱形圖案 目標圖案: 實現思路: 由目標圖案可知:該圖案共有13行,每行除了有“*”外,第一個“*”之前還包括空格。我們可以把整個圖案分為上7行和下6行來看。上7行中,空格的個數隨行數增加而減少1,“*”的個數
【c語言】輸出以下4*5的矩陣
// 輸出以下4*5的矩陣 // 1 2 3 4 5 // 2 4 6 8 10 // 3 6 9 12 15 // 4 8 12 16 20 #include <stdio.h> int main() { int i,j,k,l; for( i = 1
【C語言】輸出100~999之間的所有“水仙花數”
“水仙花數”: “水仙花數”又稱為“阿姆斯特朗數”。如果一個n(n≥3)位數的各位數字的n次冪之和等於該數本身,則該數稱為“水仙花數”。如:153=1³+5³+3³。 問題:輸出100~999之間的所有“水仙花數”。 實現思路: 根據
【C語言】輸出菱形星號圖案
#include<stdio.h> int main() { int i,j,k; for(i=0;i<=6;i++) { for(j=0;j<=5-i;j++)
【C語言】判斷一個字串是否為迴文字串。
判斷一個字串是否為迴文字串。 #include <stdio.h> int main(void) { char a[100]; int i = 0, j = 0; printf("Plea
【C語言】編寫一個程式顯示當前時間。
#include<sys/time.h> #include<time.h> #include<stdio.h> int main() {struct tm *ptm;time_t ts;char tim[50];ts = time(NUL
【C語言】實現一個函式翻轉字串
實現一個函式翻轉字串 思路:->實現翻轉 1.翻轉即前後交換 2.對於字串前後交換直到中間一個字元終止迴圈 3.令(start++)<(end–)迴圈條件不滿足退出 #incl
【C語言】編寫一個函式,實現兩個數的交換 詳細解答
今天在用函式寫兩數交換的時候發現有點小挫折,然後經過多次查詢驗證才發現是因為地址不對的緣故,我在此放出兩種交換的方法,先發錯誤的如下:#include <stdio.h> void swap(int a,int b) { int temp=a; a
【C語言】輸出N階拉丁方陣並統計個數
題目如下: 在N行N列的數陣中, 數K(1〈=K〈=N)在每行和每列中出現且僅 出現一次,這樣的數陣叫N階拉丁方陣。例如下圖就是一個五階拉丁方陣。 編一程式,從鍵盤輸入N值後,打印出所有不同的N階拉丁方陣,並統計個數。 1 2 3 4 5